- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 11:34 PM
We got a scenario where Incidents are getting created even when mandatory fields are not filled from Integrations as well as instance. Checked all client scripts and UI policies. All are working fine. May I know the reason for this issue. Please let me know how to resolve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 11:53 PM
The field level validations (such as Mandatory, ReadOnly or Visibility) won't be validated if the incident is being created through external integrations or from server side scripts within the instance.
A simple way to solve this is to ensure that right and mandatory set of inputs goes in for creation of the incident. You can have the validations being enforced on your server side scripts or integrations before the incident gets created.
On the instance side, you can have a business rule that could do the check before the record is created to check gs.isInteractive() and recognize whether it is coming from a user or REST API. The BR cannot make a field mandatory, but it can check for null/empty values and throw an error (gs.addErrorMessage()) for mandatory unpopulated fields.
Alternatively, you can look out to implement some data policies as well to fix this.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:35 AM
create data policy for this and have that field as mandatory;
so when somebody sends POST and no value in that field then it would throw an error
in left navigation type data policies; create new
give your table name and in data policy rule make your field as mandatory
let me know if you need any more help here
Regards,
Shyamkumar
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 11:48 PM
Hello @Hemanth Naik
Is data policy applied for the fields which are mandatory on forms...??
Can you try applying Data policy and then check...!!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:06 AM
Thankyou for replying, @Vishal Birajdar most of the incidents are getting created from external Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2024 12:12 AM
Hello Hemanth...
Yeah...understood....!!
As mentioned by @Amit Verma form level validations are not validated when actual data manipulation happens by external sources or while creating incident through Business rule/script.
So its better to have fields Mandatory on Database .....
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2024 11:53 PM
The field level validations (such as Mandatory, ReadOnly or Visibility) won't be validated if the incident is being created through external integrations or from server side scripts within the instance.
A simple way to solve this is to ensure that right and mandatory set of inputs goes in for creation of the incident. You can have the validations being enforced on your server side scripts or integrations before the incident gets created.
On the instance side, you can have a business rule that could do the check before the record is created to check gs.isInteractive() and recognize whether it is coming from a user or REST API. The BR cannot make a field mandatory, but it can check for null/empty values and throw an error (gs.addErrorMessage()) for mandatory unpopulated fields.
Alternatively, you can look out to implement some data policies as well to fix this.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.