- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 04:13 AM
Client Script / Business Rule to Set The Location field to Not Mandatory on Submit and on Load
Hi Guys,
On the standard 'Incident' form, how can I write a Client Script or Business Rule that makes the Location (location) field Not Mandatory, when an Incident is loaded/submitted/saved.
I want the Location field to be Mandatory = False when an Incident is saved/submitted and for that field to stay not Mandatory always, in case of further updates required, so that the Incident can be saved without Location needing to be mandatory.
Thanks for any advice/guidance.
Warwick
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 04:18 AM
Hi Warwick,
Do I understand you correctly that you want it to be mandatory, when it is a new incident, but after it has been saved the first time, it shouldn't be mandatory anymore?
If so you could use in a client script:
if(g_form.isNewRecord()){
g_form.setMandatory('location', true);
}else{
g_form.setMandatory('location', false);
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 04:29 AM
In that case it's even simpler, but you'll need to find where it is set to mandatory now.
You could look in the dictionary of the location field if it set mandatory there.
If so, create a dictionary override to remove the mandatory on the incident table, or if there already is a dictionary override on the incident table for this field, unset the mandatory there.
There could also be an existing UI Policy or client script, which is setting it to mandatory, which means you'll have to either change the client script, or configure the UI Policy action to set in as Mandatory false.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2023 05:59 AM
You're welcome Warwick. Just drop me a message if you need help with something else.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.