Mihir YSSS
Tera Contributor

Requirement: Generate predefined values in MVRS when user opens the form.

Solution:
To achieve this, need to pass the data to the MRVS in JSON string.

Below is sample JSON payload 

[{"oracle_number":"OR-569","description":"Test 11"},{"oracle_number":"OR-45","description":"Test 22"}]

Here oracle_number, description are the internal names of the variables inside multi row variable set. Below is sample code to generate values from code.

$scope.page.g_form.setValue('oracle_setup','[{"oracle_number":"OR-569","description":"Test 11"},{"oracle_number":"OR-45","description":"Test 22"}]');

After submitting catalog item, we can check that generated data as below:

find_real_file.png

Comments
Neeraj Modi1
Tera Contributor

Hi @Mihir YSSS 

 

The article is really helpful but when I have tried the same I noticed that while submitting the catalog item it is showing the message as shown below:

NeerajModi1_0-1665742612787.png

I have written below shown code in my client script on widget.

var title = JSON.stringify(response); // I can see the required data properly here.

$scope.page.g_form.setValue("plan_options", title); 

 

But once I get the leave page message, if I click on leave then it is not setting the value for that particular variable. 

Did you also got this message? 

Mihir YSSS
Tera Contributor

@Neeraj Modi1 I didn't see this behavior strangely. 

Version history
Last update:
‎06-27-2022 04:33 AM
Updated by: