Hi All,
I am using this fucntion to retreive products based on the value in product market which compares the available market to product market and filter the products.
I am facing two problem;
1. First it is not working for multiselect option set like it is filtering only when a value is selected in product market which is an option set but when I select multiple value -it is giving error as invalid argument in product field.
2. It is written on change of product market field but when I am changeing the field ,it is not triggering again and giving new value of product but blank value is showing.
Can you please help on this
marketProductFilter: function (executionContext) {
if (!NAT.Common.IsLoggedInUserFromUSA()) {
var formContext = executionContext.getFormContext();
if (formContext.getAttribute("productmarket").getValue() != null) {
var market = formContext.getAttribute("productmarket").getValue();
if (market !== null) {
var fetchXML = "<filter type='and'>" +
"<condition attribute='availablemarkets' operator='contain-values'>" +
"<value>" + market + "</value>" +
"</condition>" +
"</filter>";
formContext.getControl("product").addPreSearch(function () {
formContext.getControl("product").addCustomFilter(fetchXML);
});
}
}
}
},