How to import records into the sc_req_item table using an Excel file and the ServiceCatalog API?

Smith Johnson
Kilo Sage

Hello,

I have the following requirement that I am trying to implement.

1. I have created a simple catalog item that looks like this:

SmithJohnson_1-1778848279103.png

Variables:
Requested for (requested_for)
Request summary (request_summary)

Detailed description (detailed_description)

2. I have an Excel file where each row represents a distinct requested item. Three columns in the file store the values for each of the variables defined in the catalog item above (see Step 1).

SmithJohnson_2-1778848302008.png

 

Requirement: I want to implement a logic where an Excel file is imported, and RITMs are automatically created. Each row in the Excel file represents one RITM. The values in the row’s columns should be mapped to the corresponding variables of the catalog item.

For example, when the first row of the Excel file is imported, it should result in the creation of a RITM (e.g. RITMXXXXXX) with the following variable values:

  • Requested for: Abel Tuter
  • Request summary: First request
  • Detailed description: This is a dummy first request

3. I created a data source, like the following:

SmithJohnson_3-1778848327923.png


4. Then, I created a transform map, as shown below. 

SmithJohnson_0-1778848267262.png

 


But starting from here, I am confused. I put as target the sc_request table, but not sure if this is correct.


What the target table should be?
How can I invoke the ServiceCatalog API, Order Now, for each of the rows?

Thank you in advance,
Smith.

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@Smith Johnson 

don't use data source

Use this approach

-> create after insert BR on sc_req_item table which runs only for your catalog item

-> then grab the Excel and parse it and then for each row you can use Cart API or CartJS API to submit request

GlideExcelParser - Scoped, Global 

Parsing the Excel Sheet data & Use the data In automation via Request Item(Catalog Item) 

Understanding sn_sc.CartJS() in ServiceNow: Its Importance and Use Cases 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Hi @Ankur Bawiskar 

Thanks for your reply.
What's the drawback of using the data source approach?

@Smith Johnson 

No such drawback but you will require lot of components to be created

1) Data Source

2) Transform map

3) onBefore transform script

But if you take BR approach then only business rule you need to create and you are using OOTB ExcelParser and CartJS API for handling

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

@Ankur Bawiskar 
I see.
Could you please elaborate on the steps that I need to follow with the BR approach?
For example, where do I need to store the excel. Just in the attachments table?
What are the next steps?
Thanks again for your assistance