- 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 11:36 PM
Hi Mani,
The code which you have given is fetching all the values present in the Glide List together.
As each values has a Approval Group attached to it, we need to fetch all the groups for the approval, which is not happening through the code provided by you.
Below is 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?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2015 11:43 PM
The code I have provided will not loop through all the values in the table. It will loop through only selected values from the Glide List. Did you try that code?