I am currently trying to filter a lookup field in Dynamics 365 CRM using a fetchXML in a javascript. I have to view all the products with a custom text field ('my_variantstatus') not equal to 'R&D Stage' (and some other values). I have a problem with the character "&".
Here is my filter xml:
var filterXml = "<filter type='and'><condition attribute='my_variantstatus' operator='ne' value='R&D stage'/><condition attribute='my_variantstatus' operator='ne' value='Discontinued'/></filter>";
I have already tried remplacing the ampersand '&' with : \&, &, &, encodeURIComponent('R&D stage'), %26 but none of them worked.
Please note that the script works well when I try to filter without the ampersand ('RD stage') and that it does not work with any other special character as well (quote, <, >, etc).
This is an usual problem, try the encoding to solve it.