- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 05:03 AM - edited ‎01-16-2023 05:04 AM
Hello All,
I want to check current description is empty or not if its empty is want to abort action .
Thank You.
(function executeRule(current, previous /*null when async*/) {
current.addNullQuery(current.getValue('description'));
current.query();
if(current.next())
{
current.setAbortAction('true');
gs.addInfoMessage(current.number+" description Empty");
}
else{
gs.addInfoMessage("u can submit record");
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 06:29 AM
Hi @Sagar_pawar ,
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 05:07 AM
Hi @Sagar_pawar ,
Please refer the below link:
https://www.servicenow.com/community/developer-forum/abort-ui-action-if-field-is-empty/m-p/1562793
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 05:45 AM
Hi @Sagar_pawar ,
1)In your code there is a mistake current.setAbortAction('true').you mentioned true in string('true') but it should boolean(true) i.e current.setAbortAction(true);
Also you can abort action without using advanced script, please find below steps
1)use filter condition i.e description is empty
2) on action section, make active true add message field and abort action field
If this helps, please mark this as correct/helpful.
Thanks,
Krishnamohan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 06:05 AM
Hello, @KrishnaMohan I know how to achieve this functionality using configuration but I want to achieve the same function using customization by using addNullQuery and addNotNullQuery().
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2023 06:23 AM
Hello @Sagar_pawar ,
1)In your code there is a mistake current.setAbortAction('true').you mentioned true in string('true') but it should boolean(true) i.e current.setAbortAction(true);
2) please refer the below link
https://www.servicenow.com/community/developer-forum/null/td-p/2444301
2)In above thread second solution is optional.
If this helps, please mark this as correct/helpful.
Thanks,
Krishnamohan