- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 10:57 PM
Using If condition in UI Action, If True Perform some action and If False Perform another action:
I have a UI Action button wherein I want to include if condition within the script.
For Example: IF my logged in user is the same as 'assign to' in the form then it should save record and redirect to the same record. IF NOT then it should Save the record and redirect to the list view of that table.
Appreciate your suggestion and help.
Regards,
Narmi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:21 PM
Below is the script I used it works fine
if(current.ass_si==gs.getUserID()){
action.setRedirectURL(current);
}
else{
action.setRedirectURL('table_name_list');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:11 PM
Hello Narmi,
Code wil be
if(gs.getUserID() = current.assigned_to)
{
current.update();
}
else
{
current.update();
action.setRedirectURL(current);
}
https://www.servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:22 PM
Thank You, Pradeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:21 PM
Below is the script I used it works fine
if(current.ass_si==gs.getUserID()){
action.setRedirectURL(current);
}
else{
action.setRedirectURL('table_name_list');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:27 PM
Thank you Narmi for the update. I'm Glad you got it resolved. I see i have got condition reversed in my code.