The introduction of Dynamics 365 CE version 9 brings a lot of new functionalities and changes to the table.
One of those smaller changes, I really want to mention is the ability to open a lookup control to select one or more items.
This is something we all did in the past but in a “less” supported way… by reconstructing the URL.

Having this function in the Utility namespace with callback support, is a great addition to build a fluent user interface. Or to even address those entities that don’t allow custom relationships.

Lookup control email template example

Selecting specific email templates to us on a record.

function selectEmailTemplates() {
    var lookupObjectParams = {
        defaultViewId: "40C2BF58-128D-4280-B972-DC3928372DC7", //Default to Case templates
        allowMultiSelect: true,
        defaultEntityType: "template",
        entityTypes: ["template"]
    };

    Xrm.Utility.lookupObjects(lookupObjectParams).then(function (result) {

        //Your magic Here!

    }, function (error) {

        //Cancelation code and errors

    });
}

End result looks like:

lookup control

Full documentation and parameters can be found on Microsoft Docs: https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/lookupobjects

The post Dynamics 365 CE 9.x open lookup control support appeared first on Thrives.