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

Copy Variable information from one RITM to other

madhavib
Giga Contributor

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();

}

2 REPLIES 2

Ujjawal Vishnoi
Mega Sage

Hi Madhavib,

 

Please refer the link below.

https://community.servicenow.com/community?id=community_question&sys_id=6f830765dbd8dbc01dcaf3231f9619b7

 

Hope this helps.

 

Regards,

Ujjawal

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

 

if (gr.next())

Should be

 

while(gr.next())

 

Thanks,

Ashutosh