- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2015 08:16 AM
I am trying to create a UI action condition that the user that should see the UI action is the person that has requested the item. Would this work in the condition?
current.requested_for == gs.getUser().
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2015 01:01 PM
As you seem to be trying to combine client-side and server-side methods in a single script, you need to use a special technique that is very well explained by Mark Stanger in the following blog post:
Client & Server Code in One UI Action - ServiceNow Guru
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2015 01:51 PM
Ah! ok yea that worked. the only problem I have is that the state field is being driven by workflow and even though a item is cancelled the workflow state is still in a pending state. How can I override the workflow state on a cancellation of a workflow/ item? In my cart I am still seeing the workflow state from the workflow.
function checkCancel(){
if(g_form.getValue('u_cancel') == ''){
alert('Please provide a Cancel reason.');
g_form.setMandatory('u_cancel',true);
}
else {
gsftSubmit(null, g_form.getFormElement(), 'hr_cancel');
}
}
gs.addInfoMessage('The current item request has been cancelled.');
current.state= 4;
current.stage = 'Request Cancelled';
//get workflow helper
var workflow = new Workflow();
//cancel all the workflows, where current is a task record with a workflow context
workflow.cancel(current);
gs.addInfoMessage(gs.getMessage("Workflows for {0} have been cancelled", current.getDisplayValue()));
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2015 02:01 PM
Ill break this question into another thread because I think its a little off target for this thread.