Submitting/Updating an catalog item request using transform map ?

Gaurav Kumar15
Giga Guru

Hi All, 

We are submitting multiple requests at one time using the data source. So for creation of Request, Requested item, we have used transform script and there is no field we have added in the transform mapping as all are variables, in our data source, because of which once the transform is run, we are not able to know that how many records got inserted or how many got updated.  It is showing all rows with the Ignored status, but in actual it is updating some and inserting some rows all via the "onBefore" transform script.

Is there any better way to handle this, if someone had faced this kind of challenge, could you please share your thoughts.

TIA.

5 REPLIES 5

Mateen
Giga Guru

Call me I will explain

Sanjeev Kumar1
Kilo Sage

Hi,

You can use "Import Set API" ( https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/integrate/inbound_rest/reference/... ) to implement it.

 

  1. Create a table that extends Import Set Row
  2. Create Transform Map [Create a temp (u_reques_data) table set as target table]
  3. Writ Transform Script (onAfter and onBefore) as per requirement
  4. in onBefore write some script to Submitting/Updating an catalog item request.
  5. You neet to user (Service catalog script API) in your Transform script. ( @ https://docs.servicenow.com/bundle/newyork-application-development/page/script/server-scripting/refe... )

 

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

We have to use Cart functionality to create REQ and RITM.

var cart = new Cart();
var item = cart.addItem('e2132865c0a8016500108d9cee411699'); // Item ID
cart.setVariable(item,'os','Linux Red Hat');//Used to set variables.
 var rc = cart.placeOrder(); gs.addInfoMessage(rc.number);


Make sure you write this script in Onbefore script or script on transform maps.

Thanks,

Ashutosh Munot

 

Community Alums
Not applicable

Hi Ashutosh,

I used same above on before transform script and my transform map is on request table. But it is creating an additional request with no ritm as well. 

My excel document which I loaded contains just one catalog item sys id.

Two requests are getting creating one with ritm (sysid of the cat item) and another without ritm just request record. Can you please help me to fix the issue.

Tried using On after as well instead of on before in transform script but no luck , it's causing the same issue in my personal dev as well.

find_real_file.png

find_real_file.png

find_real_file.png