Alert with Three Options – jQueryUI in a Salesforce Custom Button

18 Aug

Recently, I was asked to create a custom button that would allow a user to choose between two SuperClone Configuration options. jQueryUI provides a nice modal dialog that solved the problem. The dialog showed two buttons for the configurations and a cancel button. Below is the sample code for what I put together. The actions for each button could be swapped out to load other any other pages or run javascript methods.

A few stackoverflow posts helped me put this together. Credit to:
jQueryUI Modal Dialog


var $g = jQuery.noConflict(); 
$g(function() {
        autoOpen: true, 
        modal: true, 
        buttons: { 
            "Config 1": function() {"superclone url here for config 1","_self");},
            "Config 2":  function() {"superclone url here for config 2","_self");},
            "Cancel":  function() {$g(this).dialog("close");}