How to set variable value of MRVS through Record producer script while creating a RITM?

Mehak1
Giga Expert

Hi,
I have created a record producer which creates multiple catalog items. I have used the cart functionality. In one of my catalog items there is MRVS, I want to set one of the variable values for that MRVS. That variable is List collector and while creating the record I am passing the sys id. But the value is not getting populated for that variable in MRVS. Basically, I am not able to set variable value for MRVS through record producer script. I tried 3 ways highlighted as red but no success.
Everything is working fine for other variables other than MRVS variables. Can anyone guide me how I can achieve it.

Here is my code which I have written in script of Record Producer:


var item;
var cartId1 = GlideGuid.generate(null);
var cart1 = new Cart(cartId1);

item = '';
item = cart1.addItem('sys_id', 1); //passed sys id of cat item
cart1.setVariable(item, 'requested_for', producer.requested_for);
cart1.setVariable(item, 'action_required', "Modify");
cart1.setVariable(item, 'modify_detail', "Group members");
cart1.setVariable(item, 'justification', producer.business_justification);
cart1.setVariable(item, 'id', producer.requested_for); // This id is the list collector variable in MRVS (Method 1)
var rc = cart1.placeOrder();

//Set variables in Multi Row Variable Set
(Method 2)
var mrvsArr = [];
mrvsArr.push({
"id": producer.requested_for
});
var mrvsArrJson = JSON.stringify(mrvsArr);
cart1.setVariable(item, 'members_added', mrvsArrJson); //members_added is MRVS internal name
(Method 3)
cart1.setVariable(item, 'members_added', '[{"id":producer.requested_for}]');

Thanks,
Mehak Arora

0 REPLIES 0