- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:10 PM
I would like to set the number of rows in a multi-row variable set to a variable in a catalog item, how should I implement this?
The requirement is that the value of the corresponding variable ("count result" in the image) is updated when it is added to the multi-line variable set.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:26 PM
for this you need to detect if user clicked add/remove, based on that populate the other variable
check this link and it will help you to detect and then modify it to populate the count variable
MRVS detect when a row is removed or deleted
OR
Why not set that variable after submitting RITM? it would be much simpler then, anyhow you are keeping that variable as readonly
If using workflow then use workflow run script and set it like this
var parsedData = JSON.parse(current.variables.mrvsVariableSetName);
current.variables.count = parsedData.length;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:12 PM
So are you saying if count is 3 it means only 3 rows can be added by user?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:18 PM
No, for example, if 4 rows are added to a multi-row variable set, I want the "count result" variable in the image to be automatically populated with "4".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:26 PM
for this you need to detect if user clicked add/remove, based on that populate the other variable
check this link and it will help you to detect and then modify it to populate the count variable
MRVS detect when a row is removed or deleted
OR
Why not set that variable after submitting RITM? it would be much simpler then, anyhow you are keeping that variable as readonly
If using workflow then use workflow run script and set it like this
var parsedData = JSON.parse(current.variables.mrvsVariableSetName);
current.variables.count = parsedData.length;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:18 PM
You want to implement this on load?
And from where you will be fetching the data? Do you have any table which is storing the data which you want to populate in the multi row variable set?
Thanks
Aniket