The Xrm.Utility provides functions that can be used in client side scripting. In CRM 2015 Update 1, one of these functions is openQuickCreate. This function is used to open a new quick create form in CRM.

Xrm.Utility

It can be called as below:

Xrm.Utility.openQuickCreate(entityLogicalName,createFromEntity,parameters).then(successCallback, errorCallback);

entityLogicalName – Logical name of an entity like an account, contact etc. It is a required parameter.

createFromEntity – Lookup parameter that provides default values based on mapped attribute values.

parameters – Querystring parameters used to populate the values on the newly created form.

successCallback – Call back function called on successful creation of record.

errorCallback – Function called when the operation fails.

var objCurrentAccount= {
    entityType: "account",
    id: Xrm.Page.data.entity.getId()
};
var callback = function (obj) {
    console.log("Created new account with id:" + obj.savedEntityReference.id);
}
var objChildAccount= {
 name: Xrm.Page.getAttribute("name").getValue(),
 telephone1:Xrm.Page.getAttribute("telephone1").getValue(),
 fax:Xrm.Page.getAttribute("fax").getValue()
 };
Xrm.Utility.openQuickCreate("account", objCurrentAccount, objChildAccount).then(callback, function (error) {     console.log(error.message); 
});

That’s all for the blog today! Check out our list of Dynamics CRM events to find a training or CRM Boot Camp near you!

Happy CRM’ing!

 

Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.