UI Action Copy button

Deepika Ravindr
Tera Contributor
 
12 REPLIES 12

@Deepika Ravindr 

when you copy REQ it's not copying RITM as well?

Did you check that?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar , yes it's coping RITM also, but it's create a new request number, they don't want like that we need copy only RITM with same request number.

 

Thanks,

Deepika

So it's like need to create child RITM.

Thanks,

Deepika

@Deepika Ravindr 

then use Cart API and it will create fresh REQ and RITM.

Delete the newly created REQ and update the earlier REQ in the newly created RITM

Sample script

try{

	var cartId = GlideGuid.generate(null);
	var cart = new Cart(cartId);
	//add your requested item to the cart by sys_id of the catalog item
	var item = cart.addItem('0336c34407d0d010540bf2508c1ed096', 1);

	//fill in the variables on the request item form
	cart.setVariable(item, "asset", "00a96c0d3790200044e0bfc8bcbe5dc3");
	cart.setVariable(item, "multiple_choice", "Phoenix");
	var rc = cart.placeOrder();
	gs.info(rc.number);

}
catch(ex){
	gs.info(ex);
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi @Ankur Bawiskar ,

Actually the above script is oki, my point is like , when we create a request then we can see copy button is ootb. but I need to create same type of button in RITM. when when click that it's create a new RITM with different number but same request number.

Thanks,

Deepika