Filter contacts based on customer

anayna
Tera Contributor

I have a requirement where i need to filter the contacts based on customer.

my two fields on the table are customer,contact

customer is refrenced to account table 

and contact is refrence to customer_contact table.

 

i tried writing a script include but it is not fetching me the results:

var getContactCustomer = Class.create();
getContactCustomer.prototype = {
initialize: function() {
},
getContact : function()
{
var contact = new GlideRecord('customer_contact');
contact.addQuery('sys_id','account');
contact.query();
if(contact.next())
{
return "account"+"="+contact.customer.toString();
}

},
type: 'getContactCustomer'
};

 

i used the script include on the variable contact :javascript : new getContact().getContact()

8 REPLIES 8

Hi @anayna 

 

Can you share the screenshot of your Reference Qualifier?

 

Also by any change is this due to active field?

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

anayna_0-1669546250583.png

 

anayna
Tera Contributor

anayna_0-1669546848430.png

 

Hi @anayna 

 

Have you verified that the record were showing before Reference Qualifier, which is not showing after filter.

 

There may be some access related restriction from Query Business rule or ACL. Please verify once.

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023