The CreatorCon Call for Content is officially open! Get started here.

How can i copy the ordered guide variable to request table

BalaLalitha Gun
Tera Contributor

Hi,

 

We have a reference variable on the ordered guide Development which is a reference variable.

I have created a custom field on Request table same as Development which is a reference field same as ordered guide variable.

 

Now, when a user selects Development from Ordered guide form then after the request creation the variable needs to be copied to Request table Development field.

 

I have created a BR. But the field is not populating.

 

How can I achieve this?

Thank you,

5 REPLIES 5

Community Alums
Not applicable

Hi @BalaLalitha Gun ,

I tried your problem in my PDI and it works for me please check below script

Please create Before Business Rule and add table name - sc_request also inserte(checked) and below code 

 

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

    // Add your code here
    var reqGr = new GlideRecord('sc_req_item');
    reqGr.addQuery('request', current.sys_id);
    reqGr.query();
    while (reqGr.next()) {
		gs.log("Inside while Test");
        // Get the value of the Development variable from the catalog item
        var val = gr.variables.<variable backend Value>;
		current.<your_new_field> = "Sarthak - " + val;
		gs.log("Inside while Test == " + val);
    }

})(current, previous);

 

Result 

I tried to add value in short_description it works for me with above script 

SarthakKashyap_0-1717955728584.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak