Hello everyone! I made a custom entity and I'm trying to get the name or id or anything that could work of an account from a lookup, and to apply a filter with that account on another lookup on opportunities, the point is to find opportunities easily (since there are a lot) by selecting the account before.
Here is what I did (It is not working and I don't know why) :
function OnChangeOfAccount(){
Xrm.Page.getControl("rta_opportunity").addPreSearch(function (){
addLookupFilter();
});
function addLookupFilter(){
if(XRM.Page.getAttribute("rta_account") != null){
var account = XRM.Page.getAttribute("rta_account").getValue()[0];
if (account != null){
fetchXml = "<filter type='and'><condition attribute='parrentaccountid' operator='eq' value='" + account + "' /></filter>";
Xrm.Page.getControl("rta_opportunity").addCustomFilter(fetchXml);
}
}
}
The error I get is : There was an error with this field customized event
Field : rta_account
Event : onchange
Error : undefined
Help me please!
*This post is locked for comments
I have the same question (0)