ATF: How to open a Catalog item using a server side script and set values

Ijaazops
Kilo Expert

Hi 

I am trying to open a catalog item and set values using a server side script specifically.

catalog name: Onboarding

fields:Country,type of project,type of facility

Thanks

Ijaazops

1 ACCEPTED SOLUTION

Nitesh Balusu
Giga Guru

You do it this way.

 

var cart = new Cart();


var item = cart.addItem("<sys_id>"); // sys_id of your catalog item


cart.setVariable(item, '<variable>', '<value>'); // Add your variables this way

cart.placeOrder(); 

 

you can also assign the outputs variable to cart.placeOrder();

like 

outputs.record_id=cart.placeOrder(); 

to get the request number to open it up later in subsequent steps.

View solution in original post

3 REPLIES 3

Nitesh Balusu
Giga Guru

You do it this way.

 

var cart = new Cart();


var item = cart.addItem("<sys_id>"); // sys_id of your catalog item


cart.setVariable(item, '<variable>', '<value>'); // Add your variables this way

cart.placeOrder(); 

 

you can also assign the outputs variable to cart.placeOrder();

like 

outputs.record_id=cart.placeOrder(); 

to get the request number to open it up later in subsequent steps.

Hi Nitesh,

 

Thank you for the solution.

Could you tell me how can i open the created request in another step, like record query step in ATF.

 

Thanks

Ijaazops

ATF has something called output and input variables.

So in the serverside script for example when you write outputs.record_id=cart.placeOrder(); 

outputs.record_id will automatically be available to use in the subsequent steps, you can either do record query, or open an existing record or stuff like that.

 

The way you use it like in the screenshot, you click that big black dot and pick the output variable from the previous step.

 

find_real_file.png