- 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 08:17 AM
Try
current.requested_for == gs.getUserID().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2015 08:28 AM
It all depends on where you are trying to place this button. The reference to the requestor comes from the Request (REQ) level. Thus if you want to have the button on REQ form, use this code:
current.requested_for == gs.getUserID();
If you are trying to set it up on Requested Item (RITM) form, dot-walk to the parent request record like this:
current.request.requested_for == gs.getUserID();
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 10:50 AM
ok so here is my UI action that should cancel the Request Item but when i click the cancel button nothing happens.
function checkCancel(){
if(g_form.getValue('u_cancel_reason') == ''){
alert('Please provide a Cancel reason.');
g_form.setMandatory('u_cancel_reason',true);
} else {
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 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/