- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 02:03 AM
Hi,
I want set a reference qualifier in the glide_list.Can some one help what is the issue with this code?It is not going inside the callback function.
filterSKUByPO: function() {
if (current.variables.u_dos_po_number == '') {
return;
}
var po=current.variables.u_dos_po_number.toString();
var list = po;
var array = list.split(",");
for (var i=0; i < array.length; i++)
{
var gr = new GlideRecord('u_po_sku');
gr.addQuery('u_po', array[i]);
gr.query();
gr.query(myCallbackFunctionforenvironments);
}
function myCallbackFunctionforenvironments(gr){
var sku_po = [];
while (gr.next()) {
sku_po.push(gr.sys_id.toString());
}
return 'sys_idIN' + sku_po.join(',');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 05:39 AM
Hi Saranya,
Give this a try... I don't see a need to do an asych GlideRecord query in this case... especially right after you do a synchronous query.
Warning: this code is completely untested. Modifications may be necessary.
filterSKUByPO: function() {
if (current.variables.u_dos_po_number == '') {
return;
}
var po = current.variables.u_dos_po_number.toString();
var poList = po.split(',');
var sku_po = [];
for (var i=0; i < poList.length; i++) {
var gr = new GlideRecord('u_po_sku');
gr.addQuery('u_po', poList[i]);
gr.query();
while (gr.next()) {
sku_po.push(gr.getValue('sys_id'));
}
}
return 'sys_idIN' + sku_po.join(',');
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 05:39 AM
Hi Saranya,
Give this a try... I don't see a need to do an asych GlideRecord query in this case... especially right after you do a synchronous query.
Warning: this code is completely untested. Modifications may be necessary.
filterSKUByPO: function() {
if (current.variables.u_dos_po_number == '') {
return;
}
var po = current.variables.u_dos_po_number.toString();
var poList = po.split(',');
var sku_po = [];
for (var i=0; i < poList.length; i++) {
var gr = new GlideRecord('u_po_sku');
gr.addQuery('u_po', poList[i]);
gr.query();
while (gr.next()) {
sku_po.push(gr.getValue('sys_id'));
}
}
return 'sys_idIN' + sku_po.join(',');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 09:35 PM
Perfect Script.Working it fine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 11:38 AM
What version are you? For helsinki you don't need to write a script. Reference qualifier is added to List Collector variable (which can be converted to glide_list easily).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2016 04:29 AM
Slight correction, it's not the reference qualifier field you have to add 'glide_list' to its the variable attribute field.