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

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi,

use the script at the solution of the below thread:

https://community.servicenow.com/community?id=community_question&sys_id=020dc769db9cdbc01dcaf3231f96...

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Hello Alberto!

Just a question. In transform Map I need to set the target table and this field is mandatory. Do you know which table I need to set on this field?

Thanks and

Regards!

Swapnil Soni1
Giga Guru

Hi,

Please try this might this helps you

When: onBefore
Script:
var cart = new Cart();
// add in cart, substitute your cat item sys_id
var item = cart.addItem('00000000000000000000000000000000');

//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,'comments',cartmsg);

var rc = cart.placeOrder();


please mark correct or helpful if applicable.
Thanks
Swapnil