- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 07:25 AM
Dear all,
When I create a new change request, and I click on the UI Action button Request Approval, I would like to add in the button script the following statment :
If Start and End Date are empty then I shouldd display a error message and abort the Request Approval process
Any idea how to do ?
regards
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 08:45 AM
Try this once from your UI action after deactivating the business rule
if (current.start_date==""){
gs.addInfoMessage("Start date should not be empty");
return false;
}else if(current.end_date==""){
gs.addInfoMessage("End date should not be empty");
return false;
}else{
//DO SOMETHING
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 07:31 AM
You would need to write a client to validate those fields and return false to stop the ui action to proceeding further. For more help check out this link
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
12-13-2018 08:32 AM
I have build a business rule for that as below :
if (current.start_date==""){
gs.addInfoMessage("Start date should not be empty");
current.setAbortAction(true);
}
if (current.end_date==""){
gs.addInfoMessage("End date should not be empty");
current.setAbortAction(true);
}
which execute Before Update.
Error message is seen on the top of the, but my Request State still goes to teh next state, how to get back to current edition state before clicking on Ui Action Approval request ?
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2018 08:45 AM
Try this once from your UI action after deactivating the business rule
if (current.start_date==""){
gs.addInfoMessage("Start date should not be empty");
return false;
}else if(current.end_date==""){
gs.addInfoMessage("End date should not be empty");
return false;
}else{
//DO SOMETHING
}