- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 05:46 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 06:36 AM
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.
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();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 06:30 AM
Please stand by.Working in progress.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 06:36 AM
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.
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 06:39 AM
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!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2015 06:44 AM
WOW
Happy your issue is resolved.