How to creat request item from Transform map

busireddy
Tera Contributor

I have created an transform and I choose the target table as "sc_target" and I have created the onBefor transform map script as below

 

var cart = new Cart();
var item = cart.addItem('10dacbc1db3b6300bdb98edf4b9619ee');
//Set Variables in your Cart Item
var cartmsg = "Import Set: " + source.sys_import_set.table_name +', Datasource:'+ source.sys_import_set.data_source;
cart.setVariable(item,'pipeline',current.variables. level_of_access);

var rc = cart.placeOrder();

when I run transform map it's creating only sc_request but it's not creating sc_req_item.

So kindly help us how to create sc_req_item via transform map?

 

 

 

 

 

20 REPLIES 20

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

the above code when runs in background script creates Request and RITM both;

Did you check in sc_req_item table?

Can you share complete script?

Regards
Ankur

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

Hi Ankur,

the script is not working so kinldy could you suggest?

Hi,

Can you inform below

1) complete script

2) what is target table

3) what you are trying to load

4) where the script is written

Regards
Ankur

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

Hi,

Pleae check the below information:

1) complete script:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

// Add your code here
var cart = new Cart();
// add in cart, substitute your cat item sys_id
var item = cart.addItem('10dacbc1db3b6300bdb98edf4b9619ee');

cart.setVariable(item,'pipeline',current.variables. level_of_access);
})(source, map, log, target);

2) what is target table:(created an tranformmap on sc_request table)

3) what you are trying to load(columns as excel sheet as: Requested for, requested by, short description)

4) where the script is written(on transfrom map before insert)

Hi,

you are not using the placeOrder method

var rc = cart.placeOrder();

Regards
Ankur

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