How to set values to multi row variable set variables in widget
Import
·
Jun 27, 2022
·
article
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:
View original source
https://www.servicenow.com/community/developer-articles/how-to-set-values-to-multi-row-variable-set-variables-in-widget/ta-p/2296624