Pre-populate 3/4 Rows in MRVS When catalog item is loaded on portal

Divya Dahate
Tera Expert

Hi All, 

 

Can we Pre-populate 3/4 Rows in MRVS When catalog item is loaded on portal?

I received a requirement where i need to show 3/4 pre-populate rows with values in MRVS (Multi Row Variable set) and last two columns should be editable.

I'm not able to find the solution for this can you please suggest something to achieve this requirement.

 

 

Thank you!

2 ACCEPTED SOLUTIONS

@Divya Dahate 

then simply form the json and set

something like this

var arr = [];
// give the correct variable names within MRVS and the correct values
var obj = {"variable1":"hello","variable2":"bye"};
arr.push(obj);

var obj1 = {"variable1":"hello1","variable2":"bye1"};
arr.push(obj1);

var obj2 = {"variable1":"hello12","variable2":"bye12"};
arr.push(obj2);

g_form.setValue('mrvsVariableName', JSON.stringify(arr));

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

View solution in original post

Hi @Ankur Bawiskar

 

Thanks again for respond.

 

I wrote this below script and it's working as i see alert msg when form is loading but this script not setting the value in MVRS 

 

function onLoad() {
    alert("Test");
    var arr;
    arr = [];
    var obj = {
        "dimresourcegroupid": "12345",
        "cloudprovider": "azure",
        "subscription": "Prod-03",
        "resource_group": "StarSchema-01",
        "billing_notification_group": "DevOps",
        "percentage_cost_change": " ",
        "daily_cost_threshold": ""
    };
    arr.push(obj);
    var obj2 = {
        "dimresourcegroupid": "12346",
        "cloudprovider": "azure-2",
        "subscription": "Prod-03-2",
        "resource_group": "StarSchema-01-2",
        "billing_notification_group": "DevOps-2",
        "percentage_cost_change": " ",
        "daily_cost_threshold": ""
    };
    arr.push(obj2);
    alert('Arr: ' + JSON.stringify(arr));

    g_form.setValue('thresholds', JSON.stringify(arr)); // Alsotried setDisplayValue
}
What can i try to set value's in MVRS?
 
DivyaDahate_0-1734075264120.png

This type of JSON is we are getting. on alert body.

 

 

Thank you!

 

View solution in original post

6 REPLIES 6

@Divya Dahate 

is the variable set name "thresholds" correct?

Also are you sure the variable name within that Json object are correct?

if yes then it should work fine

 

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

@Divya Dahate 

Did you accidentally marked your own response as correct?

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