- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
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!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
sorry but you didn't share screenshots and your script here
please share that
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
