Cannot set "Additional Comments" mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 09:32 AM
I am trying to set Additional Comments as mandatory for my incidents when state is "Resolved". When I use the button Resolve it works as supposed, but when i select the "Resolved" state from the choice list is doesn't.
I tried using UI Policies and Client Scripts to set the field as mandatory with the following script:
This is the same code snipplet used in the UI Action Button "Resolve", which works as i said. So i don't understand why this doesn't work.
I already check for other UI Policies/Client Scripts applied to the same field, but none of them seems to be overwriting my rule. I also tried the same things with the "worknotes_and_comments" field*, but it did not work.
*Since the comments and worknotes fields can be "united" using Show One Journal Field button
Is there another way that i can define a rule to set this field as mandatory following this condition?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2023 10:37 AM - edited 11-16-2023 10:40 AM
It would be helpful to post the entire script, as the issue may lie in the lines preceding this one. I assume you're running this onChange of the State field. You can also add alert lines to your script to ensure it's running, and if any IF conditions are being met. We're using this script to make Additional comments mandatory when the On hold reason changes to Awaiting Caller:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 1)
g_form.setMandatory('comments', true);
else
g_form.setMandatory('comments', false);
}