I planning change default view for to
attribute on email
entity, so instead of account
entity it will suggest user to choose recipients among contacts
.
However this functionality in MS Dynamics CRM seems to be broken. Or I missing something?
Here is the code:
(function () {
var ctrl = Xrm.Page.getControl("to");
if (ctrl) {
ctrl.setDefaultView('{13C1A58B-9AEF-4164-80E5-1D946D5BC8B3}');
console.log("Default view is set!");
}
}())
Guid points to valid view on contact
entity. The code is executed, console has debug message Default view is set!, and on using to
lookup system still uses account
by default.
Did somebody found workaround for this issue? In supported way, of course.
I was lucky to find supported, but still a bit tricky way how to achieve needed result without hacking CRM core.
The basic idea is to add any custom view to selected control, and than
setDefaultView
to any needed view that valid for the entity.So code in the question could be rewritten as:
Actually after new custom view is set, any valid view could be set as default. This could be either custom or system view.