Create RITM from Interaction

olufsen
Kilo Sage

Hi, our client wanted to generate RITM from Interaction without an associated cat_item. I re-used workspace UI Action to implement this however, the generated RITM throws an error when opened in the ESC portal. So I tried to generate a REQ then associate the RITM to it. I also created a simple WF to call to set the stage value to fulfillment. However, the WF won't trigger and I still have the same error in the ESC My Request portal.

 

Anyone can help me?

 

UI Action Table: Interaction

 

 

var req = new GlideRecord("sc_request");
req.initialize();
req.requested_for = current.opened_for;
req.opened_by = current.opened_for;
req.short_description = current.short_description;
req.description = current.description;

var reqID = req.insert();

var ritm = new GlideRecord('sc_req_item');
var wflw = new global.Workflow();
wflw.startFlow(wflw.getWorkflowFromName('RITM from Interaction'), current, 'update');

ritm.request = reqID;
ritm.short_description = current.short_description;
ritm.description = current.u_description;
ritm.assignment_group = "Service Desk";

ritm.insert();

action.openGlideRecord(ritm);
new InteractionRelationshipUtil().copyAttachments(current, ritm);

 

ESC My Request thrown error

olufsen_0-1697685824109.png

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@olufsen 

you should use Cart API to generate the REQ and RITM and not use GlideRecord

what are the variables present in the catalog item?

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@olufsen 

you should use Cart API to generate the REQ and RITM and not use GlideRecord

what are the variables present in the catalog item?

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

Thanks.  Proceeded with creating the item and wf to use the cart api. Thanks.