Multiple requested item using MRVS

Sarika S Nair1
Kilo Sage

Hi, 

I have a catalog item with one multi row variable set.I want to create multiple requested item based on number of rows in the MRVS.Suppose there are 3 rows in the MRVS, then i need 3 requested item tagged under one request.

How can i achieve this?

9 REPLIES 9

@Sarika S Nair1 

whenever you submit catalog item it will create RITM and REQ. that is out of the box

why to remove that?

the for each will run 3 times so it will create 3 RITMS

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

For each loop is running 3 times only and creating 3 requested item.But this flow is triggering after the default requested item creation.Because of that i am getting 4 requested item tagged to the request.And the requested item which is creating from For each loop doesnot have any variables defined.Only the default requested item has variables.

Request you to replicate this in your instance.

My requirement is whenever i submit the catalog item..i need one request and multiple requested item based on MRVS .

@Sarika S Nair1 

whenever you submit catalog item 1 RITM and 1 REQ will get created that is OOB behavior.

now on submission of your catalog item you are triggering flow and that is creating next RITMs

you are using Create Record action but don't use that

I already said in my 1st response to use Submit Catalog Request Action which is available OOB in flow.

When you use that you will get 3 RITMs and 3 REQs since for each will run 3 times

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Chaitanya Naidu
Tera Contributor

Hi Sarika,

 

Please use the below code in the "Run Script" activity in the workflow. Modify the catalog item sys_id and variables data as per your requirement.

 

 

 

 

var mrvs = JSON.parse(current.variables.mrvs); //mrvs is the name of the multi row variable set
var mrvsLen = mrvs.length;

for(var i=0;i<mrvsLen;i++) {
    var request = new sn_sc.CartJS();
    var item = {
        'sysparm_id': '0d08837237153000158bbfc8bcbe5d02', //sys_id of the catalog item
        'sysparm_quantity': '1',
        'variables':{ //add the catalog item variables below
            'carrier': 'at_and_t_mobility',
            'data_plan': '500MB',
            'duration': 'eighteen_months',
            'color': 'slate',
            'storage': 'sixtyfour'
        }
    };
var orderDetails = request.orderNow(item);
gs.info(JSON.stringify(orderDetails));
}

 

 

Hi Chaitanya, 

I am using flow designer for my catalog item..How can i achieve this using flow designer.?