MRVS Edit Row not showing dependent fields on editeven though onChange/onLoad works while adding row

tallurunand
Giga Contributor

Hello Team,

 

I am working on a Multi Row Variable Set (MRVS) in a ServiceNow Catalog item.

 

Requirement:

 

Based on the value selected in Task operation, I need to: 

  • Show related fields (PNS Name, PNS Host, PNS Port, PNS SID)
  • Make them mandatory

This works correctly while adding a new row in the MRVS using an onChange client script.

 

Issue:

 

After saving the record, when I click Edit Row on the MRVS:

  • The Task Operation values is already selected
  • But the dependent fields are not displayed

 

Any guidance or best practice suggestions needed.

1 ACCEPTED SOLUTION

Matthew_13
Kilo Sage

Hi Friend,

 The reason you’re seeing this is because your logic is in an onChange client script. That script only runs when the user changes the Task Operation value. When you click Edit Row, the value is already selected, so the onChange event does not fire and the dependent fields are not shown.

To resolve this:

  • Keep your existing onChange script

  • Add an onLoad client script for the MRVS

  • In the onLoad script, check the current value of Task Operation and apply the same show/mandatory logic

A good common practice I do is place the logic in a reusable function and call it from both onChange and onLoad.

This ensures the fields behave correctly both when adding a new row and when editing an existing one.

 

@tallurunand  - Please mark as Accepted Solution and Thumbs Up if you find Helpful!!

View solution in original post

2 REPLIES 2

Matthew_13
Kilo Sage

Hi Friend,

 The reason you’re seeing this is because your logic is in an onChange client script. That script only runs when the user changes the Task Operation value. When you click Edit Row, the value is already selected, so the onChange event does not fire and the dependent fields are not shown.

To resolve this:

  • Keep your existing onChange script

  • Add an onLoad client script for the MRVS

  • In the onLoad script, check the current value of Task Operation and apply the same show/mandatory logic

A good common practice I do is place the logic in a reusable function and call it from both onChange and onLoad.

This ensures the fields behave correctly both when adding a new row and when editing an existing one.

 

@tallurunand  - Please mark as Accepted Solution and Thumbs Up if you find Helpful!!

Ankur Bawiskar
Tera Patron

@tallurunand 

sorry but you didn't share screenshots and your script here 

please share that

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