Filter on link query

Hello everyone,
I am having trouble setting a filter on a link query on the Interview module. I am trying to set the filter against the Job Applicant link field but something is not working right. Can someone help me point out what could be the problem, please? I followed this document Thank you in advance.

frappe.ui.form.on("Interview", "onload", function(frm){
frm.set_query("job_applicant", function(){
    return {
        "filters": [
            ["Job Applicant", "status", "in", ["Assessment Completed", "Associates Interview Completed", "Principals Interview Completed"]],
        ]
    };
});
});

Hi @Syd,

Sometime onload and refresh event/trigger does not work.
So define a field in the event/trigger.

eg.
Replace it. onload → interview_round

Reload and check it, please.

Thank You!

I have tried that, still not working.

frappe.ui.form.on("Interview", "interview_round", function(frm) {
if (interview_round==="Interview with Associates"){
frm.set_query("job_applicant", function() {
    return {
        "filters": {
            "status": "Assessment Completed",
        }
    };
});
}});
frappe.ui.form.on("Interview", "interview_round", function(frm){
frm.set_query("job_applicant", function(){
    return {
        "filters": [
            ["Job Applicant", "status", "in", ["Assessment Completed", "Associates Interview Completed", "Principals Interview Completed"]],
        ]
    };
});
});

Only apply it then reload and check it because it’s working on my side version 13.

Thank You!

This worked, not sure why the others did not. I could not however filter the link based on what I selected on interview_round. I can live with that though. Thank you so much