Create request through import set

aagman4
Tera Contributor

Whenever a new user is added to 'User' table, raise a request to deliver laptop for the new user through import set.

 

I tried this OnBefore Transform Script -

var cart = new Cart();
var item = cart.addItem('04b7e94b4f7b4200086eeed18110c7fd');

var rc = cart.placeOrder();

 

the issue is - it is creating request for all users, it should create request for new users only and in requested by field, the name of that new user should be populated.

 

Note - I am using Load Data(excel file) and an existing import set table and transform map.

 

Please help me with this.

 

Thanks!

5 REPLIES 5

Mike_R
Kilo Patron
Kilo Patron

Save yourself a lot of trouble and just use flow designer instead. This can be accomplished very easily, see below as an example

Mike_R_0-1669917404020.png

 

Saurav11
Kilo Patron
Kilo Patron

hello,

 

Please use on after transform script with below code:-

 

if(action=='insert')
{
var cart = new Cart();
var item = cart.addItem('04b7e94b4f7b4200086eeed18110c7fd');
var rc = cart.placeOrder();
cart.requested_by = target.sys_id;
}

 

Please mark my answer as correct based on Impact

aagman4
Tera Contributor

Requested for is not getting populated with that particular user name.

I used -

cart.requested_for = target.sys_id;

aagman4
Tera Contributor

It is getting populated as System Administrator.