- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 09:36 PM
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 03:14 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 11:35 PM
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
This type of JSON is we are getting. on alert body.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 11:39 PM
yes you can use onLoad catalog client script and use GlideAjax if you wish to bring some information from table and set the JSON string
what script did you start with and where are you stuck?
I shared solution few years ago, check and enhance
How to auto-populate Multi-Row Variable Set?
check this link as well
How to auto populate project details in a multi row variable set
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 02:30 AM
Hello @Ankur Bawiskar ,
Thank you for the respond,
i don't have values in any table but my client provide me an value's for those variables, In that can what should i do?
and the for some variable's (field's) client want them as editable, So can you please suggest on the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 03:14 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2024 11:35 PM
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
This type of JSON is we are getting. on alert body.
Thank you!