Copy Variable information from one RITM to other
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2019 12:07 AM
HI All,
We have a requirement to create multiple RITM's when request is created.
I have written below code in workflow to create 2 RITM's and they are successfully getting created. Now my issue is with the variables are not getting copied on New RITM i.e, Lotus ritm. PLease let me know how can i display variable values on Lotus RITM (2nd RITM)? I can see variable info only one RITM.
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();
if (gr.next())
{
var ritm = new GlideRecord('sc_req_item');
ritm.initialize();
ritm.cat_item = 'a25b1d2237b1300054b6a3549dbe5dc3'; // 'Lotus'
ritm.request.requested_for = current.requested_for;
ritm.request = current.sys_id;
ritm.insert();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2019 12:17 AM
Hi Madhavib,
Please refer the link below.
https://community.servicenow.com/community?id=community_question&sys_id=6f830765dbd8dbc01dcaf3231f9619b7
Hope this helps.
Regards,
Ujjawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2019 01:06 AM
HI,
if (gr.next())
Should be
while(gr.next())
Thanks,
Ashutosh