Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

incidents should not be marked as "Resolved"

nehasingh98
Tera Contributor

incidents should not be marked as "Resolved" unless there are work notes explaining the resolution.

2 ACCEPTED SOLUTIONS

Runjay Patel
Giga Sage

Hi @nehasingh98 ,

 

You can create Onsubmit client script and use below code.

function onSubmit() {
    //Type appropriate comment here, and begin script below
   
 if (!g_form.getValue('work_notes') && g_form.getValue('state')==6) {
        g_form.addErrorMessage('Work Notes field is required.');
        return false;
    }
    return true;

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @nehasingh98 

Condition - State Change to Resolved.

You can achieve this by on change and on submit client script by using below statement 

g_form.setMandatory('work_notes', true);

g_form.addErrorMessage("worknotes are mandatory")

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra  

View solution in original post

2 REPLIES 2

Runjay Patel
Giga Sage

Hi @nehasingh98 ,

 

You can create Onsubmit client script and use below code.

function onSubmit() {
    //Type appropriate comment here, and begin script below
   
 if (!g_form.getValue('work_notes') && g_form.getValue('state')==6) {
        g_form.addErrorMessage('Work Notes field is required.');
        return false;
    }
    return true;

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Ravi Chandra_K
Kilo Patron
Kilo Patron

Hello @nehasingh98 

Condition - State Change to Resolved.

You can achieve this by on change and on submit client script by using below statement 

g_form.setMandatory('work_notes', true);

g_form.addErrorMessage("worknotes are mandatory")

 

Please mark the answer as helpful and correct if helped. 

Kind Regards,

Ravi Chandra