From a button on any page in Salesforce, users can launch an App that opens in Excel and automatically retrieves data from Salesforce. Depending on how this feature is configured, the flow can vary, but is essential as follows:

  1. The X-Author user clicks a button on any Salesforce page (that can accommodate a button).
  2. A new instance of Excel is opened and connects to Salesforce without any additional login required by the user.
  3. The App id specified in the button and (optionally) parent id are passed as parameters to the App.
  4. The App opens in Excel and executes the named or auto-execute Action Flow.

To implement this feature, perform the following steps in order.

  1. Configure Launch from Salesforce using a custom button or Excel App setup.
  2. Make your app launch-ready from Salesforce.
  3. Add an External ID to action flow query actions.

Any app configured to launch from Salesforce must have at least one Action Flow to execute when the app opens.

Configuring Launch from Salesforce

There are two ways to configure Launch from Salesforce by customizing the target (contextual) object. 

Option 1: Create a custom button with a launch script (For Salesforce classic Users)

  1. Go to Setup > Create > Object > Buttons, Links, and Actions. (for standard objects, go to Customize > Object > Buttons Links, and Actions)
  2. Click New Button or Link.
  3. Enter the Label. Name is auto-populated.
  4. Enter the Description of the button to help users understand the button.
  5. Select a Display Type for the button.

    Display TypeDescription
    Detail Link PageTo display the custom button as a link
    Detail Page ButtonTo display the custom button as a detail button. For example, to display the custom button with Edit, Delete, Cancel, and Clone buttons.
    List ButtonTo display the custom button as a list button. For example, to display the custom button with Merge Contacts, New, Add to Categories and so on.
  6. Click the Behavior drop-down and select Execute JavaScript.
  7. Click the Content Source and select OnClick JavaScript.
  8. Enter the following JavaScript code in the Formula Editor:

    Launch from Salesforce JavaScript Code (Customize)

    {!REQUIRESCRIPT("/xdomain/xdomain.js")} 
    {!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")} 
    {!REQUIRESCRIPT("/support/console/28.0/integration.js")} 
    
    var parentId = "{!Opportunity.Id}"; 
    var hostUrl = "https://na16.salesforce.com"; 
    var appId = "e4a933ff-6648-46ae-80b8-a4e66c6f7d29" 
    var actionflowName = "TestActionFlow2" 
    var sessionId = '{!GETSESSIONID()}'; 
    
    try {
             sforce.connection.sessionId = "{!$Api.Session_ID}"; //to avoid session timeout 
    } catch(e) { 
              erroralert(cERROR_UNKNOWN,e); 
    }
    
    var urlVal = ('xauthorforexcel:export '+ appId + ' ' + parentId + ' ' + sessionId + ' ' + hostUrl + ' ' + actionflowName); 
    window.top.location.href =urlVal;
    CODE

    Change the following in the above code to refer to your app and action flow:

    • parentId – id of the context object or related parent object where the button is placed.

    • hostURL– top domain name of the Salesforce URL

    • appId– App's unique id taken from any app record.

    • actionflowName– (Optional) Name of the action flow to execute when the App launches.

    We recommend the use of a named action flow (actionflowName) when the same app with all its mappings needs to be launched from different object records. This prevents the need to clone copies of the same app and helps in better maintainability.

  9. Click Check Syntax to verify that no errors have been made in the script.

  10. Click Save.

Option 2: Configure Excel App Setup (For Salesforce Classic and Lightning users)

There is no limit to the number of different Apps that can be launched from Salesforce. It could be a list of opportunities, or a list of opportunities or contacts for an account. You can place buttons anywhere Salesforce allows them to be located. X-Author for Excel provides a few sample buttons. To see an example, search for buttons from Salesforce Setup, then navigate to the Opportunity buttons, and locate the Edit in Excel button.

  1. Switch to the X-Author for Excel application from the Force.com App Menu or locate Apps using the + on the menu.
  2. Click the Apps tab.
  3. Click the Excel App Setup button from the Apps list view. You will see a list of example Apps that come with the X-Author for Excel managed package.

    Note

    If the Excel App Setup button is not visible, you need to add it to your App page layout. Refer to Completing Setup for Designers for instructions.

  4. Enter a Name to describe the app you want to invoke (for example, if launching Contacts from the Accounts page, "Accounts and Contacts").
  5. Click the Application drop-down and select the App to launch.

    Note

    Only activated apps are displayed in the picklist. Also, remember that a user cannot launch an app from Salesforce unless they have been assigned to the app.

  6. Click Save.

To create the Edit in Excel button on any standard or custom object

  1. Go to Setup > Build > Customize > Opportunities and select Buttons, Links and Actions.
  2. Click New Button or Link.
  3. Enter the Label. Name is auto-populated.
  4. Enter the Description of the button to help users understand the button.
  5. Select a Display Type for the button.

    Display TypeDescription
    Detail Link PageTo display the custom button as a link
    Detail Page ButtonTo display the custom button as a detail button. For example, to display the custom button with Edit, Delete, Cancel, and Clone buttons.
    List ButtonTo display the custom button as a list button. For example, to display the custom button with Merge Contacts, New, Add to Categories and so on.
  6. Select a Behavior. Click View Behavior Options to view the options of behavior. 
  7. Select Custom Source. 
  8. Enter the following code into the Formula Editor:

    /apex/Apttus_XApps__EditInExcelLaunch?parentRecordId={!Account.Id}&appName=<your_app_Name>
    CODE

    parentRecordId is the Id of the context object, and appName is the name you enter in the Edit in Excel table.

  9. Click Save. Don't forget to add the Edit in Excel button to the Salesforce page.