CRM 2011, JavaScript: Set Customer Type of Lookup

Lets say you have to set Customer type of Lookup from JavaScript. Here is the code! You just have to set another attribute and you’re done!

Here I have given it in parameters as I had to open form with these parameters auto filled.

var params = {};
params["customerid"] = Xrm.Page.getAttribute("customerid").getValue()[0].id;
params["customeridname"] = Xrm.Page.getAttribute("customerid").getValue()[0].name;
params["customeridtype"] = Xrm.Page.getAttribute("customerid").getValue()[0].entityType;

//Open a new account record
Xrm.Utility.openEntityForm("incident", null, params);

Hope it helps!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s