can we create a record directly in request table, ritm table using record producers

divyakotesh
Giga Contributor

can we create a record directly in request table, ritm table using record producers

9 REPLIES 9

Hi @Tanushree Maiti 

 

I completely agree to what you have stated. The only thing was that you stated "no" in previous post which is not entirely correct. So basic, it depends very much on the use case in general where neither one of us have any insight. 

 

Hi @AndersBGS 

 

I agree. The appropriate response should have been: "It is possible, but not recommended."

 

 

Sujit Jadhav
Kilo Sage

Hello @divyakotesh ,

This can be achieved by configuring a Record Producer and using server-side scripting with GlideRecord to insert records into the sc_request and sc_req_item tables.

 

  1. Create a Record Producer.

  2. Configure the Record Producer to target a suitable custom table.

  3. Create the required variables to capture user inputs.

  4. Add the following script in the Record Producer's Script field:

    // Create Request (REQ)
    var req = new GlideRecord('sc_request');
    req.initialize();
    req.requested_for = gs.getUserID();
    req.short_description = 'Request created via Record Producer';
    var reqSysId = req.insert();

    // Create Requested Item (RITM)
    var ritm = new GlideRecord('sc_req_item');
    ritm.initialize();
    ritm.request = reqSysId;
    ritm.short_description = 'RITM created via Record Producer';
    ritm.insert();

     


    But Still, I'll recommend you if your requirement is to create a standard Service Catalog request with REQ and RITM:

  • Use a standard Catalog Item.
  • Capture information through catalog variables.
  • Submit through the normal catalog checkout process.
  • ServiceNow automatically generates the REQ and RITM records.


"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

Thank You,

Sujit Jadhav

Ehab Pilloor
Giga Sage

Hi @divyakotesh,

 

It is best to use catalog items to generate REQs and RITMs rather than creating it with record producers

 

Regards,

Ehab Pilloor

Aditya_hublikar
Giga Sage

Hello @divyakotesh ,

 

as far i know in ServiceNow, we generally dont create Request and Requested Item records directly using a Record Producer through the standard OOTB process. Requests and RITMs are automatically generated when a user submits a Catalog Item or Order Guide. A Record Producer is primarily used to create records directly in tables such as Incident, Problem, or custom tables. However, if required, we can create REQ and RITM records using scripting or Flow Designer, but we need to handle their relationships and mandatory fields correctly.

 

If this helps you then mark it as helpful and accept as solution .

Regards,

Aditya