Return the Account Merge wizard to beginning upon completion

A while ago there was an Idea on the IdeaExchange asking if the Account Merge wizard could be returned to the beginning. I responded with a simple workaround, but the comment function of the IdeaExchange wasn’t really suited for providing the solution, so I decided to blog the solution here to make it a little easier to read and find, and also provide a new way to implement the solution.

Basically, the solution is just a simple modification to the URL used to access the Account Merge wizard. Most URLs in Salesforce.com accept a “retURL” querystring parameter that tells the page where to return the user once the operation on the current page (or series of pages) is complete. So, the URL that I came up with for this solution is:

/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp

The URL lacks any “http://…” because it needs to be relative to your particular Salesforce.com datacenter pod (NA1, NA2, Na3, etc.). Now, the only thing that you really need to do is to take this URL and make a custom link somewhere in your Salesforce org, perhaps on the sidebar or on a page layout, and you’ll have a way to launch the Account Merge wizard set to return to the beginning upon completion. 

However, you’ll probably want to make this solution a little bit more robust and create a custom tab to launch the modified Account Merge wizard. You can create Custom Web Tabs that reference a URL, but if you do this with the URL above you’ll get a second copy of the Salesforce header (tabs, application menu, etc.) under the custom tab. That isn’t very good use of screen real estate (and it is rather confusing to users), so we need to use a little bit of JavaScript magic to redirect the entire browser window to the URL that we’ve created. We can do this by creating an HTML S-control that contains the following code:


<script language="JavaScript">

function redirect()

    {

        parent.parent.frames.location.replace('/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp');

    }

redirect();

</script>  

Next, create your Custom Web Tab (Setup > Create > Tabs), and choose the “Custom S-Control” Tab Type, and associate it with the Custom S-Control that you created containing the code above. Make the tab visible to the appropriate profiles, and now you have an easily accessible Account Merge Wizard that will cycle back to the beginning upon completion.

For those who want to implement a more future-proof solution (Salesforce is in the process of phasing out S-Controls over the next few years), you can easily implement a VisualForce page that accomplishes the same thing using the following code:


<apex:page >

<script language="JavaScript">

function redirect()

    {

        parent.parent.frames.location.replace('/merge/accmergewizard.jsp?retURL=%2Fmerge%2Faccmergewizard.jsp');

    }

redirect();

</script>

</apex:page>

Then create a VisualForce Tab that references the page you created, and it will work just like the S-control solution above.

This is just one example of how you can use the parameters of the Salesforce URLs (and a little bit of JavaScript magic) to make some helpful modifications to the basic Salesforce functionality. Perhaps in later posts I’ll demonstrate some of the other neat little tricks that you can do with Salesforce URLs, custom links & buttons, and other simple tools.

(My JavaScript in the code above may not be bulletproof, so if you have any issues with the code please let me know and I’ll see if I can find a workaround.)

Advertisements

3 comments so far

  1. Jesse Middleton on

    People sometimes forget about the power of JavaScript and especially when it’s combined with some of the standard features in the cloud (like custom tabs). Great post!

  2. TiffAmbillite on

    Sorry for commenting off topic … what Word Press theme are you using? Looks awesome!!

    • apexsutherland on

      Tiff, my apologies for the delay in replying. Thanks for the comment on the theme. I’m using the “Simpla” theme by Phu Ly. You can download it from his website http://ifelse.co.uk/simpla (or get it through the WordPress theme gallery).


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: