Example that can be used to capture MRVS values, including when a record is deleted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
⚙️ 2️⃣ Detecting MRVS changes to update the main form
Now imagine you want to automatically update a “Total” field every time a row is added, removed, or modified in your MRVS.
How can you achieve this, considering the MRVS has its own event scope?
The solution: use a listener to detect any changes in the main form.
Create a Catalog Client Script of type onLoad and add the following event:
/*
Example that can be used to capture MRVS values, including when a record is deleted — a scenario for which there is currently no native event for row deletion.
Example code
check link : https://pastebin.com/4fYa8Wtj
💡 With this approach, any modification in the MRVS automatically updates the “Total” field in the main catalog form.
⚠️Important: Although this solution works well in many scenarios, it is essential to validate it with the platform architect or follow the best practices established by the development.
#ITSM#SERVICENOW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
thanks for sharing.
Could you explain why onSubmit script was used?
It would be nice if you explain the scripts
Will this also work in native or only in portal and in both catalog item and record producer?
Also it would be nice if you share the scripts rather than the link to it, the link doesn't open up.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
51m ago
Sure!
Yes, this approach should work for both catalog items (sc_req_item) and record producers.
The submit event is used to remove the event listener and prevent memory leaks. That’s why, in the onLoad, we assign the following snippet:
scope._refDereg = scope.$on('field.change', customListener);
This way, during submit, we can access scope._refDereg and properly unbind the listener.
**** I had to change some words in the script because the community does not allow certain words.
It’s important to note that I cannot guarantee 100% that this won’t have any impact on other form behaviors. Still, it’s worth sharing so the community can provide feedback — and because it offers a practical way to handle scenarios such as:
Dynamically populating multiline fields
Performing calculations when rows are added, modified, or deleted
Reacting to updates in internal tables or MRVS

