Example that can be used to capture MRVS values, including when a record is deleted

Guilherme Mazie
Tera Contributor

⚙️ 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

GuilhermeMazie_0-1763117352437.png

 

GuilhermeMazie_1-1763117376646.png


check link : https://pastebin.com/4fYa8Wtj

GuilhermeMazie_0-1763116973591.png

 

💡 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

7 REPLIES 7

@Guilherme Mazie 

I am referring whether this logic will work if user tries to submit catalog item in service catalog view and not after the submission.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I attached the update set XML for importing into the PDI. It contains a basic usage example.

I attached the update set XML for importing into the PDI. It contains a basic usage example.

GuilhermeMazie_0-1763130435061.png