Sript
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:04 AM
I have list of sys_ids. I want to get the name of corresponding sys_ids in a list
var bData=fd_data.trigger.current.u_select_buying_agent_account;
var bDataL=bData.split(',');
var nameL=[], email=[],i=0;
var gr ;
//= new GlideRecord('customer_contact');
//gr.addEncodedQuery("companyLIKEcasa^ORcompanyLIKEli & Fung");
//gr.query();
for(i=0;i<bDataL.lenght;i++)
{
gr = new GlideRecord('customer_contact');
gr.query('sys_id',bDataL[i].toString());
gr.query();
nameL[i] = gr.getDisplayName('first_name')+' '+gr.getDisplayName('last_name');
email[i] = gr.getDisplayName('email');
}
return nameL;
Not working
Please help.
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:07 AM
Hi,
USe this
var bData=fd_data.trigger.current.u_select_buying_agent_account;
var bDataL=bData.split(',');
var nameL=[], email=[],i=0;
var gr ;
for(i=0;i<bDataL.lenght;i++)
{
gr = new GlideRecord('customer_contact');
gr.addQuery('sys_id',bDataL[i].toString()); // This should be addQuery not query
gr.query();
if(gr.next()) //you were missing this
{
nameL[i] = gr.getDisplayName('first_name')+' '+gr.getDisplayName('last_name');
email[i] = gr.getDisplayName('email');
}
}
return nameL;
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:11 AM
Tried still not working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:12 AM
What did you try , can you show the script?
-Anurag
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 09:13 AM
I am taking a list collector variable in flow, then spliting