Dynamic Filter Option Not Returning Results Despite Working Through Background Script

ZachOnNow
Tera Guru

Hi everyone,

 

I created a custom dynamic filter option to return a list of CSM Account [customer_account] records for a specific persona where they are listed as an account team member with a specific responsibility.

 

From everything I've researched, I set up everything correctly so just not sure what else to do. When I run the business rule in a background script, it returns the correct Account record sys id that I'm assigned to as a team member with the specific responsibility. But nothing is returned when I use the dynamic filter option.

 

If anyone with experience with dynamic filter options could lend a hand, it would be very much appreciated.

 

FYI: In this instance, Account is relabeled as Plan

 

Dynamic Filter Option:

Screenshot 2025-11-20 191740.png

On-Demand Global Business Rule:

function getMyPlans() {

    var plans = new GlideRecord('customer_account');
    plans.addEncodedQuery('^RLQUERYsn_customerservice_team_member.account,>=1^type=aa7d2def1bc57610dd96eac2604bcbfd^responsibility=7b2ce1ef1bc57610dd96eac2604bcbc5^userDYNAMIC90d1921e5f510100a9ad2572f2b477fe^ENDRLQUERY');
    plans.query();

    var myPlans = [];
    while (plans.next()) {
        myPlans.push(plans.sys_id.toString());
    }

    return myPlans;
}

Related List Query:

Screenshot 2025-11-20 192157.png

Empty Result:

Screenshot 2025-11-20 192538.png

Background Script:

gs.info(getMyPlans());

Background Script Result:

*** Script: 0f6f267787c76e50461feb9d0ebb356e

 

1 REPLY 1

ZachOnNow
Tera Guru

For people facing this issue down the line, I eventually figured it out. It was not an issue with the code as I expected, the fix was that instead of containing the code in a global business rule. The code needed to be contained in a script include with these settings:

Glide AJAX enabled: true

Sandbox enabled: true

Accessible from: All application scopes

 

!! Deleted this specific line of code from script: Object.extendsObject(global.AbstractAjaxProcessor,