Populating response in MRVS using onSubmit client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Hi all,
I am getting the expected response but not able to populate/ set value in MRVS field, Please suggest
based on the attachment 'employee id's will be populated in mrvs and onsubmit associated first and last name should be populate in the mrvs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi there, this is a common MRVS gotcha..
Even if your GlideAjax response looks correct, the MRVS will only populate if you set the MRVS variable itself the multi-row set field and the value you pass is JSON in the MRVS row format array of objects keyed by the MRVS variable names.
Lets see please check:
Make sure you’re doing g_form.setValue('<MRVS_VARIABLE_NAME>', JSON.stringify(rows));
not setting a field inside the MRVSThe JSON must be like:
[ {"u_employee_id":"123","u_first_name":"John"}, {"u_employee_id":"456","u_first_name":"Jane"} ]Where the keys match the variable names inside the MRVS.
If you’re calling GlideAjax in a loop don’t set the MRVS inside each callback and async responses can overwrite each other. Build the rows array and set the MRVS once after all responses return.
Once I switched to setting the MRVS field directly and only updating it once at the end, it populated consistently.
@Ankita9793 - Please mark as Accepted Solution and Thumbs Up if you found Helpful!!