I am trying to create filtering lookup with Custom View, but my Java Script is given error.Error screen shot has attached below.
I used the below code:
*********************************************************
function HandleOnChangeLocationLookup()
{
alert('On Change Called for Location');
var locAttr = Xrm.Page.data.entity.attributes.get("contoso_location");
if (locAttr.getValue() != null)
{
var locationID = locAttr.getValue()[0].id;
}
var viewID = locationID;
var viewDisplayName = "Filtered by Location - " + locAttr.getValue()[0].name;
var viewIsDefault = true;
var fetchXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contoso_room">
<attribute name="contoso_roomid"/>
<attribute name="contoso_name"/>
<attribute name="createdOn"/>
<order attribute="contoso_name" descending="false"/>
<filter type="and">
<condition attribute="contoso_locationid" operator="eq" value="' +locationID +'"/>
</filter>
</entity>
</fetch>';
var layoutXml = '<grid name="resultset" object="10001" jump="contoso_name" select="1" icon="1" preview="1">
<row name="result" id="contoso_roomid">
<cell name="contoso_name" width="300" />
<cell name="createdon" width="125"/>
</row>
</grid>';
var roomControl = Xrm.Page.ui.controls.get("contoso_room");
roomControl.addCustomView(viewID,"contoso_room", viewDisplayName,fetchXml,layoutXml,viewIsDefault );
}
*************************************************************************
My code is working fine up to var viewIsDefault = true;
But from var fetchXML creation, it is given error.
Please help!!
Thanks in Advance!!
Regards
Vivek