i want to fetch the contact account locations from the user email.

Community Alums
Not applicable

I have created one record Producer, which consists of two Variables, one is requestor_name and the other one is meeting_event_location.

The Requestor_name is referring to sys_user table and the meeting_event_location referring to cmn_location table

I want that from user email, i want to fetch the contact account locations, i have written the below script include for that, but its not working. can someone please help me why this script is not working.

 

accountLocation: function(d)
{
var user = new GlideRecord('sys_user');
        user.get(gs.getUserID());
 
var contact = new GlideRecord('customer_contact');
contact.addQuery('email', user.email);
contact.query();
 
if(contact.next()){
 
var cont = contact.getValue('sys_id');
}
 
var locationlist = [];
        var loclist = new GlideRecord('cmn_location');
        loclist.addEncodedQuery('account.u_corporate_account', d.cont.account);
        loclist.query();
        while (loclist.next()) {
            locationlist.push(loclist.getValue('sys_id'));
        }
        return 'sys_idIN' + locationlist;
 
 
},
 
And i am using Advanced reference qualifier in variable (meeting_event_location)
 
the reference qualifier is = javascript:new sn_customerservice.locationlist().accountLocation(current)

  

5 REPLIES 5

Jaspal Singh
Mega Patron
Mega Patron

loclist.addEncodedQuery('account.u_corporate_account', d.cont.account);

should it not be

loclist.addEncodedQuery('account.u_corporate_account'+d.cont.account);

or

loclist.addQuery('account.u_corporate_account', d.cont.account);

Community Alums
Not applicable

Let me Try this one (loclist.addEncodedQuery('account.u_corporate_account', d.cont.account);

Community Alums
Not applicable

Hey Jaspal its working for only for current logged in user, how i make it work all the users? please let me know as it is urgent 

Community Alums
Not applicable

can someone please help me as this is very urgent