Identify all mandatory fields in Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 05:08 AM
The Scenario is
When we move the change ticket from new to peer review, need to check if mandatory fields in the change tasks are filled
If the mandatory fields of the change tasks are not filled we need throw a error message
Is there any prebuilt function in servicenow server script to identify all the mandatory fields on a form
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 05:11 AM
i think you have to handle those feild value is emty or not bby script in BR
like
if(current.short_descrtion ==''''}
{
gs. add error mesasge
current.setabort action
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 06:07 AM
Thank you
Even I used the same in my script. So I wanted to know is there any other prebuilt function which does the same
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2022 01:59 PM
Hi
You can use the nil() method of GlideElement API.
https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server_legacy/c_GlideElementAPI#r_GlideElement-nil?navFilter=glideelement
If(current.assigned_to.nil()){
// Do Something
}
But the approach below will also work fine.
if(!current.assigned_to || current.assigned_to == ""){
// Do something
}
Please mark my answer as correct/helpful, if it helped
Thanks