Get Value From Catalog Item To Request Table

priyaaitha
Kilo Explorer

I have catalog item (i.e.,Maintain Item)form which consists of different fields like Requested For,Short Description,Request Type etc.,

On submit of the form I want to Request Type field should be mapped/populated into REQUEST table Item field.

Can anyone suggest me on this as i'm looking only for Catalog Item not for a Record Producer.

Appreciate Your Help!

Thanks

Priya.

3 REPLIES 3

Mike Patel
Tera Sage

So lets say your request type name is u_request_type on Request. Add below Run Script to your catalog item workflow;



//Set Parent Request Short Description//


var reqParent = current.request.getRefRecord();


reqParent.autoSysFields(false);


reqParent.u_request_type = current.variables.request_type;


reqParent.update();


Hi Mukesh ,


No it didn't work .Can you suggest me any other alternative.


Priya,



Requests and Request items work differently than practically everywhere in ServiceNow, and it may seem a bit backwards... but I will explain. First of all, you have to recall that one Request can have multiple Request Items, so make sure your situation allows for more than one RITM unless you have turned off two step checkout. Secondly, the order of operations that ServiceNow uses is as follows from the Cart checkout:


A) Get a unique identifier for a Request record (sc_request) but *do not create the record yet*


B) Create Request Item (RITM) records for each Cart Item being checked out, putting in the sys_id generated in Step A into Request, even though the record is not yet in the database


C) Write the Request (REQ) to the database.



Because of this order of operations, you actually can't write to the Request from the Request Item insert logic. Instead, you have to pull from Request Item when the Request is written, or some other method as you see fit.



-Ken Michelson