How to create multiple Ritms under one request for different catalog item?

Rini1
Tera Guru

Helo,

Is it possible to create one request and after it is submitted that give rise to 2 or more RITMs which each follow their own workflow? Shopping cart is an option I know and also Like the way order guide works, but without having to create an order guide. 

Thanks

Rini

1 ACCEPTED SOLUTION

Ratnakar7
Mega Sage
Mega Sage

Hi @Rini1 ,

Apart from Order Guide, you can create multiple RITMs under one request for different catalog items using the Service Catalog API (specifically, the sn_sc.CartJS API),

Here is an example code snippet to add multiple catalog items to the cart using CartJS:

 

 

// Get the cart
var cart = new sn_sc.CartJS();

// Add item 1 to the cart
var item1 = {
   sys_id: 'catalog_item_sys_id_1',
   quantity: 1,
   variables: {
      var1: 'value1',
      var2: 'value2'
   }
};
cart.addToCart(item1);

// Add item 2 to the cart
var item2 = {
   sys_id: 'catalog_item_sys_id_2',
   quantity: 2,
   variables: {
      var3: 'value3',
      var4: 'value4'
   }
};
cart.addToCart(item2);

 

 

This will add catalog_item_sys_id_1 with a quantity of 1 and catalog_item_sys_id_2 with a quantity of 2 to the cart. The variables for each item can also be set as shown in the example.

 

Also refer CartJS 

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar

View solution in original post

1 REPLY 1

Ratnakar7
Mega Sage
Mega Sage

Hi @Rini1 ,

Apart from Order Guide, you can create multiple RITMs under one request for different catalog items using the Service Catalog API (specifically, the sn_sc.CartJS API),

Here is an example code snippet to add multiple catalog items to the cart using CartJS:

 

 

// Get the cart
var cart = new sn_sc.CartJS();

// Add item 1 to the cart
var item1 = {
   sys_id: 'catalog_item_sys_id_1',
   quantity: 1,
   variables: {
      var1: 'value1',
      var2: 'value2'
   }
};
cart.addToCart(item1);

// Add item 2 to the cart
var item2 = {
   sys_id: 'catalog_item_sys_id_2',
   quantity: 2,
   variables: {
      var3: 'value3',
      var4: 'value4'
   }
};
cart.addToCart(item2);

 

 

This will add catalog_item_sys_id_1 with a quantity of 1 and catalog_item_sys_id_2 with a quantity of 2 to the cart. The variables for each item can also be set as shown in the example.

 

Also refer CartJS 

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar