Our customers have versions of our Java web app installed in their data center. I want to build a managed packaged Salesforce App that is able to connect to those web app instances using Salesforce Canvas.

As I planned to packaged the Connected Canvas App it seems that I then would have to hardcode the base URL (domain), which would make it impossible for package customers to change it to their own endpoints.

Is any of my potential solutions feasible?

1) Use a Loopback URL which points to a packaged Visualforce page that redirects based on a dynamic URL provided in the Canvas parameters.

2) Use something like externally stored endpoint information. Custom settings or Named Credentials that could be used inside the Canvas.

3) Let the User create the Connected Canvas App outside of the Managed Package but reference it inside my package. E.g. A Lightning Component where I pass the DeveloperName of the Canvas App.

  • 1
    My vote is option 2. You could use your own custom object too..either way, best practice is for you to provide your own, custom screens for users to change the config and then you do whatever you need to do underneath the hood. The update of a connected app should work via Metadata API...although I haven't tried it.
    – identigral
    Jul 14, 2019 at 17:20
  • 1
    Consider using Dynamic Client Registration, which basically allows for dynamic creation of connected apps. Not sure if it applies to your Canvas App case, but a good read nevertheless Jul 21, 2019 at 14:50

1 Answer 1


I've used Custom Metadata Types in the past to give the installed orgs the ability to adjust settings of the Canvas App.

When creating the custom metadata field, use the "Any user with the Customize Application permission" radio in the Field Manageability parameter to give installed orgs the ability to adjust the value, without it being overwritten with future managed package updates.

For your situation, create a Custom Metdata Type called " Settings", and create a custom metadata type field called "Endpoint URL" with the URL type (MDTs don't have the full breath of custom fields options, but they give you URL which is what you need here). Make sure to select that radio as I described above when creating the field:

enter image description here

Now create an actual MDT record, and call it something simple like "Default" so you have the actual MDT record for the installed org to work with.

As for accessing it within the Canvas App - you can use an Apex class (which can be leveraged by a VF page and/or lightning aura component - I did both implementations so Classic and Lightning could be supported) to simply query the MDT to get the URL endpoint value. If you do this in the aura init handler and/or the VF page action parameter - you'll be able to set the CanvasApp parameters before it's actually initialized.

Sample Query:

    public static String getEndpointUrl() {
        List<MyConnectApp_Settings__mdt> settings = [SELECT Id, MasterLabel, QualifiedApiName, Endpoint_URL__c FROM MyConnectedApp_Setting__mdt];

        for (My_App_Setting__mdt setting : settings)
            if (setting.QualifiedApiName == 'Default')
                return setting.Endpoint_URL__c;

        return null;
  • 1
    That's awesome Brian. I didn't expect a positive answer here. Would you mind adding more details to your answer and I am happy to accept it ASAP. Maybe with a screenshot of the Custom metadata and its fields and settings. Or how you get the info from the metadata into the Connected App / Canvas App definition. May 9, 2019 at 13:16
  • 1
    Literally swamped with work atm, but will update my answer with more details. I might be able to do a fuller response later May 9, 2019 at 13:35
  • 1
    Just updated the answer, and it's my pleasure to help! Only started becoming active on SFSE a couple months ago and really enjoy / appreciate the community here! May 9, 2019 at 13:46
  • Can you also show (screenshot of Canvas Edit screen) how you get the endpoint into the Canvas App settings, please? May 9, 2019 at 13:50
  • 1
    I just realized you wanted to update the actual connected app endpoints themselves, and not just pass the endpoint via the canvasApp's parameters attribute. Shoot, back to the drawing board... May 9, 2019 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .