Announcements
Hello everyone,
The filter I want to create is as follows: I want to filter a field (uneeti_agreementinvoiceproduct) located in my table (msdyn_customerasset). The filter must meet the following conditions: firstly, the customer of the contract must be equal to the asset account. In my fetchXML query from my table (msdyn_agreementinvoiceproduct), I will retrieve the linked contract table (msdyn_agreement) and the field (msdyn_serviceaccount) for comparison. Secondly, I want to display only the products that are already associated with the contract asset. Therefore, I retrieve my product field from my table (msdyn_customerasset) and fetch the (msdyn_product) from my table (msdyn_agreementinvoiceproduct). Here is my retrieval query, along with the error that is occurring. I don't understand this error because the specified field is not associated with the indicated table.
Can someone help me resolve this issue ?
JS :
function filterProductContratFS(context) {
var formContext = context.getFormContext();
var fieldRecipientCall = formContext.getAttribute(/msdyn_account/).getValue();
var fieldRecipientCall2 = formContext.getAttribute(/msdyn_product/).getValue();
if (fieldRecipientCall && fieldRecipientCall2) {
var accountId = fieldRecipientCall[0].id;
var productId = fieldRecipientCall2[0].id;
console.log(accountId);
console.log(productId);
var fetchXML =
/<fetch>/ +
/<entity name='msdyn_agreementinvoiceproduct'>/ +
/<link-entity name='msdyn_agreement' from='msdyn_agreementid' to='msdyn_agreement'>/ +
/<filter>/ +
/<condition attribute='msdyn_serviceaccount' operator='eq' value='/ + accountId + /' uitype='account'/>/ +
/</filter>/ +
/</link-entity>/ +
/<link-entity name='msdyn_customerasset' from='msdyn_customerassetid' to='msdyn_agreementinvoiceproductid'>/ +
/<filter>/ +
/<condition attribute='msdyn_product' operator='eq' value='/ + productId + /' />/ +
/</filter>/ +
/</link-entity>/ +
/</entity>/ +
/</fetch>/;
var agreementInvoiceProductControl = formContext.getControl(/uneeti_agreementinvoiceproduct/);
agreementInvoiceProductControl.addPreSearch(function () {
agreementInvoiceProductControl.addCustomFilter(fetchXML);
});
} else {
return;
}}
Error :
André Arnaud de Cal...
294,110
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator