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

Hi Vinoth,



Can you please share the script for this requirement.


We look for a similar use case.



Regards,


Sowmiya M


On Demand Schedules Jobs are best and works like Wonder for such requirements.



Never use Transform maps and Transform Scripts if you have   var rc = cart.placeOrder(); in your script. If you use Transform map, then duplicate records gets created because Transform maps tries to create new RITM and then Place order also creates RITM thus having redundancy.


Michael Kaufman
Giga Guru

oleksiykosenkov
Giga Contributor

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

Unfortunately you must insert them manually.
Tables of your interest:

  • [sc_cat_item] holds the definitions for your Catalog Items
  • [item_option_new] holds definitions of variables
  • [sc_item_option] contains the values a user has entered for the variables associated to the items in the cart
  • [sc_item_option_mtom] is a many-to-many table relating these variable values to their respective Requested Items
  • [sc_req_item] contains the Requested Items

Below is the code to initialize variables for Requested Item grReqIt (take note this GlideRecord was properly initialized and saved outside of this code snippet) with the value. Variable definitions are copied from Catalog Item grReqIt referrs. You need a bit more research if you use Variable Sets or initialize Catalog Task's variables. 

	function setVariables(grReqIt, value) {
		var grCatItVar = new GlideRecord('item_option_new');
		
		grCatItVar.query('cat_item', grReqIt.cat_item);
		grCatItVar.addActiveQuery();
		
		grCatItVar.query();
		while (grCatItVar.next()) {
			
			// create variable value, initialize it and save
			var grReqItVar = new GlideRecord('sc_item_option');
			grReqItVar.initialize();
			
			grReqItVar.item_option_new = ''+grCatItVar.sys_id;
			grReqItVar.value = value;
			
			grReqItVar.insert();
			
			// relate variable value to requested item
			var grItVarRel = new GlideRecord('sc_item_option_mtom');
			grItVarRel.initialize();
			
			grItVarRel.request_item = ''+grReqIt.sys_id;
			grItVarRel.sc_item_option = ''+grReqItVar.sys_id;
			
			grItVarRel.insert();
		}
	}