Additional comment mandatory when state is on hold

JordyZ
Mega Sage

Hi,

 

I'd like to have additional comments mandatory when trying to save incident state to on hold. Meaning, it is not possible to save state to on hold unless there's something filled in the additional comments.

 

I have tried this onChange client script from a different thread, but it doesn't work.

Thread: https://www.servicenow.com/community/now-platform-forum/need-logic-to-make-comments-mandatory-when-s...

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    if (newValue == 3) {
        g_form.setMandatory('comments', true);
    }
}

 

What did I do wrong?

1 ACCEPTED SOLUTION

Uncle Rob
Kilo Patron

Are people using a UI Action to move it to On Hold?  Or are they changing the state manually?

If its the latter a UI Policy is the best option for this.  

View solution in original post

5 REPLIES 5

Hi @Deepika18,

 

I have a similar issue here, I am not sure if it is the same as below. I have applied the policy and action as per the above, but this still allows the state to be changed without a comment in the Additional comments field. The solution I am looking for is;

 

If user is trying to change state from "New" to "In Progress" the user should have to mandatory make a customer visible additional comment. 

 

I have tried this with both states set in the condition, but putting it on New, does not allow new tickets to be created, putting it on In Progress, the incident can be set, but the additional comments is not required when pressing save.

 

I hope this makes sense, any help would be appreciated

 

Steven