how to set reference variable value from another table

Ash41
Kilo Sage

Hi Team, 

 

I need to set value in reference variable from the mtom table using business rule. I have tried client scrip it is setting the value but, I also need to use that reference value in flow, it is showing empty, due to that I go for BR. Please suggest.

 

 

 

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

var reqSYSID = current.sys_id;
var gr = new GlideRecord('sc_item_option_mtom');
        gr.addQuery('request_item.number',reqSYSID );
		gr.addQuery('sc_item_option.item_option_new','a4d0a2efdb5b69108935e786059619e3');
        gr.query();
        if(gr.next()){
            var serviceID =  gr.sc_item_option.value.getDisplayValue();
		current.variables.ABC = serviceID; // reference variable
		current.update();

     }

})(current, previous);

 

@Ankur Bawiskar 

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Ash41 

BR is on which table?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

BR is on sc_req_item table. 

 After insert

@Ash41 

I agree to the point mentioned by Sandeep.

Why to copy same info into another variable?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

SANDEEP28
Mega Sage

@Ash41 If value is present in one variable of request item then why do you want copy the same value in another variable unless you are doing any modification into that value.