- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 10:27 AM
We have a OnChange client script on the Incident table that sets the Additional comments mandatory when the Incident is in state Cancelled. This script should prevent canceling the incident if the additional comments are empty. It was working before the upgrade to Tokyo.
If I change the state from any state to Canceled doesn't work, but after selecting the canceled state and changed back to any other state and then changed back again to canceled it works. But not when is first selected.
If I enable the field watcher on the state field it works, but after disabling it, it doesn't work again.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
//Type appropriate comment here, and begin script below
if (newValue == '8') {
g_form.setMandatory("comments", true);
} else {
g_form.setMandatory("comments", false);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 12:11 PM - edited 05-04-2023 12:14 PM
The UI Policy on the Incident table "Make the field 'Additional Comments' mandatory when the On Hold Reason is 'Awaiting Caller'" is conflicting with your client script.
Here in my Personal Dev instance, I have disabled that UI Policy and your script is working correctly.
The easiest solution is disable your client script and update the UI Policy by using the "Add OR Clause" button to add an Or condition to this UI policy and state "OR - State is Canceled" like below:
The other solution is to disable the UI Policy and use your Client Script.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 11:46 AM
You should be able to just remove the ' ' around the 8 as it is not a string, it's a value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 12:15 PM
Hi Ian, removing the "" didn't work. Still having the same experience.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 12:11 PM - edited 05-04-2023 12:14 PM
The UI Policy on the Incident table "Make the field 'Additional Comments' mandatory when the On Hold Reason is 'Awaiting Caller'" is conflicting with your client script.
Here in my Personal Dev instance, I have disabled that UI Policy and your script is working correctly.
The easiest solution is disable your client script and update the UI Policy by using the "Add OR Clause" button to add an Or condition to this UI policy and state "OR - State is Canceled" like below:
The other solution is to disable the UI Policy and use your Client Script.
Please mark this response as correct and/or helpful if it assisted you with your question.
Steven