Active=true in Reference Qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 12:03 AM
I want to add additional condition active=true in my existing script in the reference qualifier for the Variable 'Line Manager', I tried adding the below script but it is not working, Can you help me where I'm going wrong?
javascript: "company=" +current.variables.company^active=true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:07 AM - edited 05-02-2023 03:36 AM
Hi @Kri
could you try this. If company is empty, it should not show anything to it
For additional query condition, active = true. - Could you let me know once the backend names of Company field and active field. Just to cross check.
If backend names are - 'company' and 'active' only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 03:41 AM
yes it is 'company' and 'active' only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 04:30 AM
then the below query should definitely work. Something else is fishy. Try putting the records as active- false and then test it.
javascript: if(current.variables.company != "") "company="+current.variables.company+"^active=true"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 05:46 AM
This didn't works, it is still giving full values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 06:18 AM - edited 05-02-2023 06:46 AM
Then you can call the Script Include method from reference qualifier and in the function do the GlideRecord to 'customer contact' table with the same query in addEncodedQuery().
Reference qualifier-
javascript: new ScriptIncludeName().getCustomerContacts(current.variables.company);
Create a new Script include-
function: getCustomerContacts(vCompany){
var arrSysIds = []; // array to store the records
var grCustomerContact = new GlideRecord('customer_contact');
grCustomerContact.addQuery('company',vCompany.toString());
grCustomerContact.addActiveQuery(); //queries only active record, you can write grCustomerContact.addQuery('active',true);
grCustomerContact.query();
while(grCustomerContact.next()){
arrSysIds.push(grCustomerContact.sys_id.toString());
}
return arrSysIds.toString();
}
It should solve this issue. I didn't run the code but it should work. Let me know if it gives any error
You can try one more thing for testing purpose, just put the condition as Active is True in simple reference qualifier and see if it is giving only active records in reference field.