- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 10:11 PM
HI,
We need to pass an array value to the GlideRecord Query in the Workflow. We have used the following code to pass an array value.
var answer = [];
var app = current.functions.getDisplayValue();
var array = app.split(",");
//var array1 = new ArrayUtil().unique(array);
var grBS = new GlideRecord('u_ecare_choicevalues');
for (var i=0; i < array.length; i++) {
grBS.addQuery('u_name', array[i]);
grBS.query();
while(grBS.next())
{
answer.push(grBS.approval_group);
}
}
Here the problem is , its taking the first value and its not taking running for the other values.
Can you please help us fix this issue.
Solved! Go to Solution.
- Labels:
-
Integrations
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 11:50 PM
HI Harish,
Thanks for the help.
I made some changes to the code and it is working now.
var answer = [];
var govap = current.functions.getDisplayValue();
gs.log('function1:'+govap);
var arrayVal = govap.split(",");
len = arrayVal.length;
for (var i=0; i<=len; i++) {
var grBS = new GlideRecord('u_ecare_demand_choicevalues');
//grBS.addQuery('u_name', arrayVal[i]);
grBS.addQuery('u_name','IN', arrayVal[i]);
grBS.query();
while(grBS.next())
{
answer.push(grBS.approval_group);
gs.log('function2:'+ arrayVal[i]);
}
gs.log('function3:'+ arrayVal[i]);
}
I queried through the for loop and got "grBS.addQuery('u_name','IN', arrayVal[i]);" instead of grBS.addQuery('u_name', arrayVal[i]); , therefore it is working now.
Thanks for the help Harish Murikinati and Mani kanta Korada .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 10:18 PM
Hi Vaigai, I think you need to declare grBS inside the for loop.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 10:44 PM
Try below code now . It should work.
var answer = [];
var app = current.functions.getDisplayValue();
var arrayval = app.split(",");
//var array1 = new ArrayUtil().unique(array);
var len = arrayval.length;
for (var i=0; len>i; i++)
{
var grBS = new GlideRecord('u_ecare_choicevalues');
grBS.addQuery('u_name', arrayval[i]);
grBS.query();
while(grBS.next())
{
answer.push(grBS.approval_group);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 11:23 PM
Hi Harish,
Below is the explanation of the requirement:-
For Example:- We have more than one value in the Glide List A. And suppose the values are 1 and 2.
Each Value 1 and 2 are having a field called Approval group.
We are trying to fetch both the Approval Groups, in case 1 and 2 are selected in the Glide list A.
Can you now explain if the code provided by you will help?
Actually i tried that and it didn't help.
Thanks,
Vaigai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 11:31 PM
Have you tried the above code? it doesn't work?