Copying a variable from one RITM to another

turnea
Mega Expert

Has anyone got a script that will copy a variable from one RITM to another within the same REQ?   I have a catalog item that is primary (PRF), then you can add several secondary items (Additional PRF).   There's a section where the team leads assign an IT Engineer (it_engineer) to being the request to completion, but it occurred to me that the IT Engineer needs to be automatically added to the other RITMs.   Any idea how we can accomplish this?

Thank you,

Amandah

1 ACCEPTED SOLUTION

Hi Amandah,



Here is the updated code. Please go through it. In this case execute business rule only when the catalog item is primary catalog item. How we do that?


Yes this is simple all you need to do is under "When to run" select the filter condtition as item.name is the item name.


Screen Shot 2015-09-17 at 7.05.38 PM.JPG


Script :


var gr = new GlideRecord('sc_req_item');  


gr.addQuery('request', current.request);  


gr.addQuery('cat_item_name', 'Additional PRF');     //Assuming Additional PRF is the catalog item name


gr.query();  


while(gr.next())  


{  


gr.variables.it_engineer = current.variables.it_engineer;


gr.update();  


}  


View solution in original post

8 REPLIES 8

Please stand by.Working in progress.


Hi Amandah,



Here is the updated code. Please go through it. In this case execute business rule only when the catalog item is primary catalog item. How we do that?


Yes this is simple all you need to do is under "When to run" select the filter condtition as item.name is the item name.


Screen Shot 2015-09-17 at 7.05.38 PM.JPG


Script :


var gr = new GlideRecord('sc_req_item');  


gr.addQuery('request', current.request);  


gr.addQuery('cat_item_name', 'Additional PRF');     //Assuming Additional PRF is the catalog item name


gr.query();  


while(gr.next())  


{  


gr.variables.it_engineer = current.variables.it_engineer;


gr.update();  


}  


Hi Pradeep,



This was perfect - the only thing different that we did was add it as a Run Script directly in the original PRF workflow as opposed to the Business Rule, as we have a ton of catalog items in our catalog.



Thank you so much!


WOW


Happy your issue is resolved.