Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to populate values in the multi row variable set variables without click on the "Add" button

Shantharao
Kilo Sage

How to populate values in the multi row variable set variables without click on the "Add" button

5 REPLIES 5

Hello,
Try this and confirm your variable set name is "mrvs"

function onLoad() {
var mrvs_data = {};
mrvs_data = setMRVStier1(1);
var oDetails = mrvs_data;
for (var sKey in oDetails) {
if (sKey == "mrvs") { //add your Variable set Name
g_form.setValue(sKey, JSON.stringify(oDetails[sKey]));
}
}
}

function setMRVStier1(num) {
var obj = {};
var obj2 = {};
var obj3 = {};
var objArr = [];
for (var i = 1; i <= num; i++) {
obj = {
"manager": "Test1", // variable Name and value
"phone_number": "123456789",
"email": "test@gmail.com"
};
obj2 = {
"manager": "User",
"phone_number": "2345678970",
"email": "test1@gmail.com"
};
obj3 = {
"manager": "user2",
"phone_number": "1234567890",
"email": "test2@gmail.com"
};

objArr.push(obj, obj2,obj3);
}

return {
"mrvs": objArr
};
}

function clearRows(sysIdMRWS) {
TableVariableService.removeAllRows(sysIdMRWS);
}