Siddhesh Gawade
Mega Sage
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
yesterday - edited 2 hours ago
Introduction
When building catalog items with Multi-Row Variable Sets (MRVS) in ServiceNow, you often need to propagate a selection/change inside a MRVS row to variables/fields on the parent Record. MRVS variable scripts run inside an iframe; to read or write the parent record's variables or fields you must use parent.g_form
Example — How It Works
- Concept: Read the current MRVS row values with local
g_form.getValue('variable_name'), and set parent RITM variables withparent.g_form.setValue('variable_name').
- Minimal OnChange Catalog Client Script example on MRVS:
function onChange(control, oldValue, newValue, isLoading) { if (isLoading || newValue === '') return; // read row-level values (local g_form) var Account= g_form.getValue('company'); // set parent RITM variables so the values are available on the Parent form / RITM record parent.g_form.setValue('selected_company', Account); }
Summary
- Use
parent.g_forminside MRVS client scripts to read/write RITM variables and keep MRVS state synchronized with the parent record.
- Workflow-friendly pattern: read row values (local
g_form), modify MRVS JSON on the parent, then update parent variables viaparent.g_form.setValue(...).
- Keep parsing safe, avoid heavy logic on the client, and use server-side validation for authoritative checks.
Labels: