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.

Copy Tags

Shobha
Kilo Contributor

Hi All,

We need to copy the tag in call(u_mservice_calls) to case(u_mservice_case)

i wrote the BR on u_mservice_calls, in logs i got the name of tag in logs.. but it didn't create tag in case.. so can someone help me here

 if (current.transferred_to != '') {
        var mcase = new GlideRecord('u_mservice_case');
        mcase.addQuery('sys_id', current.transferred_to);
        mcase.query();
        if (mcase.next()) {
           mcase.u_applied_tags = current.applied_tags;

 

Thanks in advance

 

 

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi Shobha,

What i see here is , you have two different custom tables.

you can use something similar to this code , just replace with your table name:

Please try below script in before insert and update Business rule on label_entry table

 

find_real_file.png

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Hi Shobha,

What i see here is , you have two different custom tables.

you can use something similar to this code , just replace with your table name:

Please try below script in before insert and update Business rule on label_entry table

 

find_real_file.png

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

Thank you Sandeep Dutta.

Harish KM
Kilo Patron
Kilo Patron

Hi I can see only few lines of script. Try below

 if (current.transferred_to != '') {
        var mcase = new GlideRecord('u_mservice_case');
        mcase.addQuery('sys_id', current.transferred_to);
        mcase.query();
        if (mcase.next()) {
           mcase.u_applied_tags = current.applied_tags;

           mcase.update();

}

Regards
Harish

suvro
Mega Sage

Use the below code

 if (current.transferred_to != '') {
        var mcase = new GlideRecord('u_mservice_case');
        mcase.addQuery('sys_id', current.transferred_to.sys_id);
        mcase.query();
        if (mcase.next()) {
           mcase.u_applied_tags = current.applied_tags;
           mcase.update();
}
}