Several customers have asked me if it’s possible to grant access to Unique Entry by Profile. I figured the response I came up with was worth blogging about so other customers have the solution as well.
The Unique Entry application contains Visualforce Pages that you, during installation, use to override your “New” buttons for Accounts, Contacts, and/or Leads. This means that everyone who clicks these buttons to create new records will be directed to the Unique Entry pages instead of the standard pages. Some customers don’t want everyone to use the Unique Entry application, but only users with specific Profiles.
How NOT to do it
It would seem logical to simply pick and choose the Profiles who should have access in the installation wizard step pictured below. Unfortunately this step is very misleading when it comes to the Unique Entry application. If you do not give access to a Profile that has access to create Accounts, Contacts, or Leads during this step then they will receive an “insufficient privileges” error message when they click the “New” button since the button is now directing them to a Page to which they don’t have access.
The right solution
So how do you do it? Well, in the installation wizard make sure you grant access to all Profiles and then what we’re going to do is create a sneaky Visualforce Page to be a gatekeeper, of sorts, and override our “New” buttons with this new Page instead of the ones that come with Unique Entry.
So for example, if we want to allow only two Profiles to use the Unique Entry application when entering Leads, we would create the following Visualforce Page. You can do this from the setup menu, use the search box above the menu tree to search for “Pages” then click Pages and choose to create a new Page. Then copy and paste the following:
You can see here we are granting access to the “System Administrator” and “Standard User” Profiles, but we can modify the contents of this OR() statement to include whatever Profiles we want. Give the Page a name and save it. Then override your Lead “New” button with this Page you’ve just created. That’s it, users with those Profiles you’ve included in the OR() statement will be directed to the Unique Entry application while all others will go to the standard Salesforce entry page.
You can repeat this with Accounts and Contacts as well. You would have to change “Lead” to be “Account” or “Contact” and the “00Q” would need to be changed to “001” for Accounts and “003” for Contacts.
There you go… piece of cake. Maybe you thought you’d never write a Visualforce Page, but you were wrong!
Learn more tips for your CRM with the free whitepaper below.