- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 10:48 AM
Hi Community,
I have a requirement that the "comments" field be mandatory when the state of an incident is "on hold". I need to create logic that makes this field mandatory only on the initial state update. For example, if the state has been changed to "on hold" and a user goes back in to update work notes, the comments field should not be mandatory at this time as the update has already been made.
How can I accomplish this? I have a UI policy created, but it is checking the state each time, so the comments are always mandatory.
Thank you,
Heather
Solved! Go to Solution.
- Labels:
-
User Experience and Design

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 10:56 AM
Hi,
You can use an onChange client script for that field that upon change to On Hold, you can make the comments mandatory. This would only take effect onChange of that field and not if a user comes to that form without changing it, but needs to make update to another field, etc.
(EXAMPLE😞
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 3) {
g_form.setMandatory('comments', true);
}
}
Please change the value 3 if "On Hold" is not 3 for your instance. 3 is the default value for the state field on Incident for On Hold.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 10:54 AM
Configure business rules to make comment mandatory so that it works on both client and server side/
You have current and previous objects in business rules which you need to make use of.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 10:56 AM
Hi,
You can use an onChange client script for that field that upon change to On Hold, you can make the comments mandatory. This would only take effect onChange of that field and not if a user comes to that form without changing it, but needs to make update to another field, etc.
(EXAMPLE😞
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 3) {
g_form.setMandatory('comments', true);
}
}
Please change the value 3 if "On Hold" is not 3 for your instance. 3 is the default value for the state field on Incident for On Hold.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2021 12:36 PM
Thank you Allen! This worked for me.