- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 03:20 AM
I have some fields of a table which I want to be mandatory under certain conditions only.
To do this on a form, I can write a client script which does g_form.setMandatory or I can write a UI Policy.
What about if I want to do this on a list? What is the best practice for making fields conditionally mandatory so that list edits will fail if the conditionally-mandatory fields are blank?
Concrete example: I want the Department field to be mandatory if the Company field is filled in on the Users table. If Company is blank, then Department can be blank too. If I set this up on the form, the policy can be avoided by editing using the list editor instead of the form.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 06:28 AM
You can try adding gs.isInteractive condition in your script and that should do the job for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 03:26 AM
Create a data policy, its same as ui policy, infact the same ui policy can be converted into data policy too.
Mail difference is that ui policy only runs on a form for any input coming form form but data policy runs everywhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 04:12 AM
As Kalai suggested, Before BR (insert, update) will work just fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 03:51 AM
I forgot to add one more point: the condition needs to be done in JavaScript because it is too complex for the condition builder. So a data policy will not help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2015 03:53 AM
Use a before business rule. Abort the action if the data is empty and show some info message to the user.