I’ve been looking into how to enable the ‘new’ button on custom entities. Here is what I have found. O yeah, For the direct solution scroll to the end of the mail.
- You can set test some things when using this url:
Ofcourse modify the servername and the objecttypes to match your situation
- The properties and new button can be set by using the querystring parameters as given above.
- There is one additional piece of hard coding in the class Microsoft.Crm.Web.Controls.Lookup.LookupPageBase. This particular piece of code is this:
for (int j = 0; j < this._objectTypes.Length; j++)
switch (int.Parse(this._objectTypes[j], CultureInfo.InvariantCulture))
this._canCreateAccount = base.CurrentUser.GetPrivilege(Privileges.CreateAccount);
this._canCreateContact = base.CurrentUser.GetPrivilege(Privileges.CreateContact);
this._canCreateOpportunity = base.CurrentUser.GetPrivilege(Privileges.CreateOpportunity);
this._canCreateLead = base.CurrentUser.GetPrivilege(Privileges.CreateLead);
this._canCreateList = base.CurrentUser.GetPrivilege(Privileges.CreateList);
this._showNewButton = ((this._canCreateAccount || this._canCreateContact) || (this._canCreateLead || this._canCreateOpportunity)) || this._canCreateList;
What it does, is looking to the specified list of objecttypecodes and looks if any of these match the id of account, contact, lead, opportunity or (marketing)list. If it does not match one of those, then the new button is hidden.
- You can also modify the file ‘lookupsingle.aspx’. In this file there is the function window.onload() function. Modify this function to add these lines to the end:
//enable new button
btnNew.style.display = 'inline';
This will cause the new button to be visible.
That’s about it. Just add the line above and you’ll be ready to go. The new button will now be available for all entities. I haven’t tested this through so that will need to be done in your situation. Also note that this is unsupported and will not be migrated to a potential upgrade to titan or might be lost after an install of a hotfix.
Hope this helps,