Set Query not applied

I want to filter my Healthcare Practitioner on a “location” basis (custom field).
Location is the common field in Patient Appointments and Healthcare Practitioners.

This is my code.

cur_frm.set_query(“practitioner”, function () {
return {
“filters”: {
“location”: cur_frm.doc.location
}
}
});

But no result.

The practitioner record is not filtered, even though the set query filter is displayed in the dropdown.

Also, edited the field location in the search field section of customize form, but not visible in the dropdown.

scrnli_9_9_2021_10-55-03%20AM

try this:

frm.set_query("healthcare_practitioner", function() {
    return {
        filters: [
            ["Healthcare Practitioner","location", "=", cur_frm.doc.location]
        ]
    }
});

Thanks for getting back.
Tried, but no luck. @OmarJaber

try to put the filtering code after location selection