Need to Create a Request and RITM through transform mapping

vinothkumar
Tera Guru

Hi,

 

Can any one help me on this, I need to create REQ and RITM for the sercvice catalog "New shoretel mobility Request" through transform mapping. If i have 10 values in the Excel, It has to create 10 request.

 

Is there any possibility to do this?

 

I dont have idea about how to add variables in the ritm also..

 

Thanks in Advance.

8 REPLIES 8

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could use the Service Catalog API to create requests programmatically through Transform Map Scripts.


Thanks Brad..I tried..but it is not working as Intended..some dummy requests also created..


1)   Load your import set.


2)   Modify this 'On Demand' schedule job to fit your needs:



var gfr = new GlideRecord('<import set table name>');   //name of your import set table name


gfr.addQuery('sys_import_state', '!=', 'inserted');


gfr.query();


while (gfr.next()){


  //query import set table to get field names


  var cart = new Cart();


  var csgrname = new GlideRecord('sys_user');


  csgrname.get('name', gfr.u_requested_for); //This assumes that the requested for field is part of your import file


  var item = cart.addItem('<Catalog sys_id>'); //sys id of the catalog item you want to use


//Below, set your catalog variables to the variable names in your item


  cart.setVariable(item, 'requested_for', csgrname.sys_id);


  cart.setVariable(item, 'v_frontrange_nbr', gfr.u_frontrange_number);


  cart.setVariable(item, 'task_due_date', gfr.u_task_due_date);


  cart.setVariable(item, 'v_description', gfr.u_description);


  var rc = cart.placeOrder();


  gfr.sys_import_state = 'inserted';


  gfr.update();


}


Hi Jordan,



Thanks a lot for your effort.



Regards,


Vinoth kumar M.