Create a business rule / onsubmit script to restrict the form from updating/submitting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 08:00 PM
Hi Team,
I am using an Onchange client script on outage form to show error message on two fields. But the issue is that i am able to save or submit the form despite the error. Can we create a business rule / onsubmit client script to restrict the form from updating/submitting if there are field error message .Could you please let me know what alternate ways we can try to achieve this.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 10:25 PM
@Uttam Sai write below code in on submit client script
if(g_form.getValue('<ABORT SUBMIT FIELD NAME>')){
return false; //This will abort the submit
}
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2023 07:50 PM
Hi Prasath,
I have a state field and when the user from non assignment group wants to complete it i need to restrict them to complete the task . I want to write a before update BR . Can you give me the sample BR for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 09:29 PM
@Uttam Sai Create a new field called "Abort Submit" (true/false) type. Keep it on the form but hide it in onload client script.
In the on change client script you have set the "Abort Submit" field to true if you show message else set to false.
Create a on submit client script and check if "Abort Submit" is true or false.
if its true
return false; to abort action
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 10:23 PM
Hi @jaheerhattiwale ,
Could you please provide the onsubmit script to check if "Abort Submit" is true or false. and then abort action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 10:26 PM
@Uttam Sai write below code in on submit client script
if(g_form.getValue('<ABORT SUBMIT FIELD NAME>')){
return false; //This will abort the submit
}
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023