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.

business rule for case and incident worknotes

Xila
Tera Contributor

In Incident form assigned to someone then update the worknotes something in case form.

1 ACCEPTED SOLUTION

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Xila ,

How are you defining relationship between case and incident?

Is there any custom field ? Then map that in below code.

Write down business rule on incident form

When : After Update

Condition: assigned to changes AND case is not empty(your reference field)

GunjanKiratkar_0-1669793829792.png

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var gr = new GlideRecord("sn_customerservice_case");
    gr.addQuery("referenceFieldOnCaseForm", current.sys_id);  //Writedown your field name from case table which refers to the incident number
    gr.query();
    if (gr.next()) {
        gr.work_notes = "Assigned To is Changes to " + current.getDisplayValue('assigned_to');
		gr.update();
    }


})(current, previous);

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

3 REPLIES 3

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Xila ,

How are you defining relationship between case and incident?

Is there any custom field ? Then map that in below code.

Write down business rule on incident form

When : After Update

Condition: assigned to changes AND case is not empty(your reference field)

GunjanKiratkar_0-1669793829792.png

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var gr = new GlideRecord("sn_customerservice_case");
    gr.addQuery("referenceFieldOnCaseForm", current.sys_id);  //Writedown your field name from case table which refers to the incident number
    gr.query();
    if (gr.next()) {
        gr.work_notes = "Assigned To is Changes to " + current.getDisplayValue('assigned_to');
		gr.update();
    }


})(current, previous);

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Musab Rasheed
Tera Sage

Hello,

This is easy requirement, what have you tried so far ?

Please hit like and mark my response as correct if that helps
Regards,
Musab

Community Alums
Not applicable

hi @Xila 

Can you pls explain your use case as case and incident are different, so exactly what you want to do??

If you want to copy-additional-comment-worknotes-from-incident-to-case, pls check below link:

 

https://www.servicenow.com/community/csm-forum/copy-additional-comment-worknotes-from-incident-to-ca...

 

Please mark this as helpful or solution for the query, if it helped you or resolved your doubt.