Hi all,
i'm using Javascript to add a custom view to a custom Lookup. but it did not work correctly
this is my code
control = Xrm.Page.getControl("febb_textmoduleid");
if (control != null) {
var entityTypeName = Xrm.Page.data.entity.getEntityName();
var filter = "<filter type='and'>"
+ "<filter type='or'>"
+ "<condition attribute='febb_entityname' operator='like' value='%%%' />"
+ "<condition attribute='febb_entityname' operator='like' value='%" + entityTypeName + "%' />"
+ "</filter>"
+ "</filter>";
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
+ "<entity name='febb_textmodule'>"
+ "<attribute name='febb_textmoduleid' />"
+ "<attribute name='febb_name' />"
+ "<attribute name='febb_text' />"
+ "<order attribute='febb_name' descending='false' />"
+ filter
+ "</entity>"
+ "</fetch>";
var layoutXml = "<grid name='resultset' object='10020' jump='febb_name' select='1' icon='1' preview='1'>"
+ "<row name='result' id='febb_textmoduleid'>"
+ "<cell name='febb_name' width='150' />"
+ "<cell name='febb_text' width='300' disableSorting='1' />"
+ "</row>"
+ "</grid>";
//control.addCustomFilter(filter);
var viewName = "Available Text Modules for this Entity";
var viewId = "{" + febb.Helpers.GenerateGuid() + "}";
//debugger;
control.addCustomView(viewId, "febb_textmodule", viewName, fetchXml, layoutXml, false);
control.setDefaultView(viewId);
}
if i click the lookup i receive the error Message "Record Is Unabailable - Record not found or no permissions to view it".
But if i click on "Lookup more Records" after the error message. The custom view is set as default and the view is working correctly.
what is wrong?
View selector is enabled.
Ciao
Pascal