Can't override "mandatory" on a field when a specific assignment group is selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 01:19 PM - edited 03-27-2023 01:20 PM
I'm trying to remove the "Mandatory requirement on a field when the record is assigned to a specific assignment group.
This is the client script I'm using with little success.
function onChange() {
var group = g_form.getValue ('assignment_group');
if ( group =='4ae156f81bd2a010d544cb7e034bcb5a') { g_form.setMandatory(' field name', false);
}
}
Any Help is apreciated.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 02:54 PM
Hi Dave,
Have you turned Watch on for that field? The likely causes are that either some other client script, UI Policy or Data Policy is setting the item back to mandatory. Keep in mind that client scripts run before UI Policies and Data Polices. "Watchng" that field when it loads and/or changes will let you see what objects are acting against your field. Also, have you tried putting an info message into the script to confirm that it is executing?
As a matter of best practice, it is considered worst practice to hard code sys_ids as they can vary across instances. This little code snippet will let you grab the display value for the field
g_form.getDisplayBox("<your field name").value
:{)
Helpful and Correct tags are appreciated and help others to find information faster

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 02:55 PM
Hi @davesekerak
That's how your client script should look like to work fine. Although use of only onchange() is also fine.
If you are still not able to change the Mandatory to false, Check the following.
1. Right Click on the Mandatory variable and Click configure Dictionary.
3. Verify that Mandatory check is True or False.
4. At the Bottom in Dictionary Overrides, Verify that there is no record that's is created for your table with dictionary override for Mandatory.
5. If record is found or Mandatory is checked as True, Make them False.
6. Verify that UI Policy is being used to make the field Mandatory.
Using the Dictionary Override and Mandatory checked at the same time can cause the issue.
Regards,
Ashir Waheed