Hi comunnity, I'm having difficulty implementing Oleksandr Olashyn's example https://www.dancingwithcrm.com/custom-lookup-filtering-powerapps-portal/. Apparently the filter does not work with my example.

The dependent field is "Account Name" it doesn't show me anything and it should change based on the "Relationship Type" field.
This is the web template to perform the filter through fetchxml:

And this is the custom JavaScipt that the form has configured:
$(document).ready(function () {
// register onPrimaryChange function to run on change of dwc_primarycategorization field
$("#crb6a_new_relationshiptype").change(onPrimaryChange);
$("#crb6a_new_relationshiptype").change();
});
function onPrimaryChange(){
// get id of selected primary field
// this will work only if you render primary field as dropdown
let primaryValue = $("#crb6a_new_relationshiptype option:selected").val();
console.log(primaryValue);
// remove all option from dependent field
$("#parentcustomerid").empty();
if(primaryValue != null && primaryValue !=""){
// request to our custom page with id as parameter
$.getJSON( "/pedido/getaccountjson?relationshiptype="+primaryValue, function( data ) {
if(data.results.length>0){
//create option for each returned entity
data.results.forEach(element => {
let option = document.createElement("option");
option.value = element.Id;
option.innerText = element.Name;
$("#parentcustomerid").append(option);
console.log(option);
});
}
}
);
}
}
Can someone help me here?
Thanks guys.