Hi All,
I am applying below code to filter my lookup control but i am facing below issue when script loading onto the form.
I am posting both the code and scenario. Please help
1)First Error
Error : fetchXML is not defined.
code:
function setLookupView()
{
Xrm.Page.getControl("cdemo_casetype").addPreSearch(filterCaseType);
}
function filterCaseType()
{
var _product = Xrm.Page.getAttribute("productid").getValue();
if (_product != null)
{
var _productid = _product[0].id;
var _productname = _product[0].name;
}
var fetchXML = "<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">" +
"<entity name=\"demo_casetype\">" +
"<attribute name=\"demo_casetypeid\" />" +
"<attribute name=\"demo_casetype\" />" +
"<attribute name=\"createdon\" />" +
"<order attribute=\"demo_casetype\" descending=\"false\" />" +
"<link-entity name=\"demo_casesubtype\" from=\"demo_casetypeid\" to=\"demo_casetypeid\" alias=\"ac\">" +
"<filter type=\"and\">" +
"<condition attribute=\"demo_productgroup\" operator=\"eq\" uiname=\""+_productname+"\" uitype=\"demo_productgroup\" value=\""+ _productid +"\" />" +
"</filter>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
Xrm.Page.getControl("demo_casetype").addCustomFilter(fetchXml);
}
*This post is locked for comments