Ever wanted to quickly call some JS function, without the need to create 3947 one liners? Just create empty JS library and add Form OnLoad Event, for example:
JavaScript
Important thing to remember when using addCustomView
When using addCustomView keep in mind that You must include entity Id field in FetchXML (accountid for Account entity, for example) otherwise it won’t be saved after selecting value.
Set blank.htm in iframe in CRM 2013
There is a blank.htm file in CRMWeb/_static, which can be used to display blank page for iframe. But CRM keeps adding http:// in URL field of iframe 🙁 To simply set it, open iframe properties, press F12 and enter this into console:
document.getElementById('Url').value = '/_static/blank.htm'
Then OK, Save, Publish 🙂
Lookup Dialog in CRM 2013 with custom FetchXML filtering
Dynamics 2013 introduced some new cool functions to filter lookup during “run-time”, so we can do something like this:
var ctrl = Xrm.Page.getControl('some_lookup_control');
ctrl.addPreSearch(function() {
var someFetchXml = '<filter type="and"><condition attribute="some_field" operator="eq" value="some_value" /></filter>';
ctrl.addCustomFilter(someFetchXml);
});