Thursday, November 8, 2012

Salesforce Merge Accounts URL Hacking

The Merge Accounts page is OK to use, however to start the process you have to search for the Accounts you want to merge, and to do that they have to have the same name. This is not always the case, and it can be annoying to have to rename an account, just so you can find it to merge it.

The official SFDC selection screen also limits you to a max of 3 accounts. This isn't actually a hard limit... More of a guide, as you'll see below.
Instead of this, you can actually hack the URL to include the IDs of any accounts, regardless of Account Name similarity. This is especially useful if you are using your own code to manage merges and would like to "deep link" into the SFDC platform.

Here's an example URL:
https://emea.salesforce.com/merge/accmergewizard.jsp?goNext=+Next+&cid=001200000012345&cid=001200000012346&cid=001200000012347&cid=001200000012348
It can be broken down into 3 main segments:

The Merge Accounts page URL:
https://emea.salesforce.com/merge/accmergewizard.jsp


A Parameter to indicate that SFDC should start merging, and it will expect account IDs to be on the URL:
goNext=+Next+

The last segment is a collection of SFDC Account IDs. All use the parameter name of "cid". In the above example there are 4, however you may include as many as you like (I've successfully merged 75 accounts at once), including more than the default 3 allowed by the web form:

cid=001200000012345
cid=001200000012346
cid=001200000012347
cid=001200000012348


Replace these IDs with the Accounts you would like to merge, and you should be presented with the familiar Merge Account page.

To select what account should be the "Master Record" put add this to the url:

p2=ACCOUNTID