- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2020 11:27 PM
Hello Everyone!
I have a workflow on the case table that runs a script, I have a GlideRecord in that script that checks the values entered in a MRVS(Multi Row Variable Set)
If I enter two values, the warn result would show the right values I entered
But when I show the rows array in a warn it will show just one value duplicated twice.
Any Idea why that happens ?
Thanks a bunch
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 01:28 AM
instead of gr.value you have to use gr.getValue('value') or gr.value.toString().
gr.value returns an object which is used in JavaScript by Reference. Therefore your record always includes a reference to the same object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2020 11:51 PM
Hi,
please write "rows.push(gr.value)"
outside while loop.
var gr = new GlideRecord("sc_multi_row_question_answer");
gr.addQuery("parent_id",current.sys_id);
gr.query();
while(gr.next())
{
gs.warn(gr.value);
}
rows.push(gr.value);
Please mark correct or helpful based on the impact.
Regards,
Aniket Sawant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2020 11:57 PM
I have tried that it only showed the first value entered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 01:28 AM
instead of gr.value you have to use gr.getValue('value') or gr.value.toString().
gr.value returns an object which is used in JavaScript by Reference. Therefore your record always includes a reference to the same object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2020 01:42 AM
Hi,
use either toString() or getValue()
example below
rows.push(gr.value.toString())
OR
rows.push(gr.getValue('value'));
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader