- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 09:16 AM
I'm trying to trigger a business rule on the sc_req_item table on the condition when any variable within a multi-row variable set changes. current.variables.changes() works fine for variables outside of MRVS but not variables inside.
I've also tried current.variables.*variablesetname*.changes() but that gives an error
Any suggestions? Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 10:09 AM
you cannot determine if MRVS got changed or not
you will have to take another approach
1) Create a hidden variable on your catalog item of type string
2) Set this with the value from MRVS using run script of workflow
Run script in workflow:
current.variables.<hiddenVariable> = current.variables.product_model;
current.setWorkflow(false);
current.update();
3) then use after update BR
Condition: current.variables.changes()
Script:
1) get the current value of MRVS
2) you already have the original value of MRVS in the hidden variable
3) compare both the json array and then determine if anything changed
Refer below link on how to compare 2 json array of strings
How to check if JSON array is equal to
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 09:23 AM
Hi,
In place of varaiblesetname did you gave the actual variable set name?
Also, can you share the error here once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 09:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 10:09 AM
you cannot determine if MRVS got changed or not
you will have to take another approach
1) Create a hidden variable on your catalog item of type string
2) Set this with the value from MRVS using run script of workflow
Run script in workflow:
current.variables.<hiddenVariable> = current.variables.product_model;
current.setWorkflow(false);
current.update();
3) then use after update BR
Condition: current.variables.changes()
Script:
1) get the current value of MRVS
2) you already have the original value of MRVS in the hidden variable
3) compare both the json array and then determine if anything changed
Refer below link on how to compare 2 json array of strings
How to check if JSON array is equal to
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 02:55 AM
Hope you are doing good.
Let me know if I have answered your question.
If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.
If not, please let us know if you need some more assistance.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader