function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jeremy WeberJeremy Weber 

Canvas App URL - issue having one endpoint

Hey All, 

 

The fact that the canvas app url only provides one endpoint seems to be problematic for us.  We provide the application that is connected, and under the course of normal development would like to be able to put up test versions, etc, without breaking current production users and without having to change the canvas url in the managed package.  Updating the managed package to just change the url seems heavy handed, and problematic as it would need to manually changed back to the production endpoint before release.

 

Generally we have multiple endpoints for test, beta and prod.   And it seems logical that I wouldnt need to change the managed package based on whether its running in test or prod.  Any suggestions on how I can publish a managed package with the one url but have it target a different endpoint based on something?

 

Any thoughts would be appreciated.

 

Thanks

 

Jeremy

 

 

Ashish_SFDCAshish_SFDC

Hi Jeremy, 

 

Will it be possible to test with a different package or a different developer org instead. 

 

Regards,

Ashish

Jeremy WeberJeremy Weber

Of course thats possible, but its far from ideal, as i am sure you can understand.  Using multiple managed packages, essentially equates to having distinct applications for different environments.   Having this distinction causes complexity for development, testing and release. When coupled with the fact that each managed package must have a unique namespace, it makes the whole process tricky and frail.

 

So I am still looking for guidance here, and perhaps a best practice for SF developers using canvas connected apps.

jhurstjhurst

Jeremy,

 

I would have a couple of thoughts for you.

 

1. Create a staging app.  This would be the test app that you have, it would have a separate Canvas URL and a separate (or the same if desired) DE org.  This would allow you to do all the demos/testing and then when ready, simply push the changes into your production app (no need to change the managed package at all)

 

2. Use a custom setting in the managed package which would hold the URL you want to go to.  Your app could then make an API call to the custom setting to determine what URL to go to (we have partners doing this today)

 

Hope this helps.

Jay

Jeremy WeberJeremy Weber

Hey Jay 

 

Thanks for the response!  I am very interested in #2 but not very sure its entirely possible.  When defining the Connected App its required that you enter a URL. Do you think its possible to have this field instead come from a custom setting?   It sounds like you have partners doing this, but Im not clear if they are doing it with a connect app and its canvas url.

 

 

Thanks!

 

Jeremy

jhurstjhurst

The Canvas URL has to be provided and it is static.  The way other partners are doing this is to send the signed request to that endpoint, that endpoint does any logic that it needs (including querrying for custom settings), and then redirects to the URL that they would like to direct to.


For instance, say your canvas URL is https://www.mydomain.com/canvas.  The signed request is sent there.  That URL then does an API call to get info that would determine to go to a dev instance (maybe a custom setting, maybe some other logic you implement).  If the custom setting comes back pointing to dev (maybe the custom setting is a URL?), then the page gets redirected there with the signed request.

Jeremy WeberJeremy Weber

I understand what are you saying and we have implemented a solution that similiar to the one you suggested in regards to the redirection, etc.  However, in this scenario its difficult to change the application that handles this redirection - because its a sole point of entry into the system.  So basically if i want to update the redirection logic there is no current facility to point to a new endpoint to test, nor a way to infer the endpoint from some other setting.  The only way i see to do it would be to reissue the managed package once for each canvas url. Not crazy about having to maintain more than one managed package and the situation becomes even more drastic as we scale and add new operatng environments.

 

Do you think its possible to change canvas app url, through some sort of  installation script when the user install the MP into their environment?  Thats one avenue I have yet to explore.

jhurstjhurst

No...the canvas URL is static and set in the org the app was originally created in.

 

Here is what I would suggest (and maybe you are doing this already)

 

1. Create your production managed package.  This contains the canvas app with the production endpoint and any other components you need.

 

2. Create a second canvas app (not in a managed package, but just as an app) and point the url to your test server.  Here you can run any changes you need, test stuff out, and even create a beta package if needed to install the test app into another org

 

3. When promoting changes from your test to production, you would change the production managed package if needed

Daniel BallingerDaniel Ballinger
A bit late to the party, but can the Canvas URL be used with Named Credentials? Then the canvas url could be static and the actual endpoint could be changed as required.

Just found the idea: Allow multiple endpoints on a Canvas app (https://success.salesforce.com/ideaView?id=08730000000DgZcAAK)
 
Jay Hurst
We released the ability in Spring '14 to tie an Apex class to a canvas app [Customizing Your App Lifecycle (https://developer.salesforce.com/docs/atlas.en-us.platform_connect.meta/platform_connect/canvas_customizing_app_lifecycle.htm)].  This class [CanvasLifecycleHandler] can change the path of the canvas url to whatever you would like, but not the domain.  So you could change from https://www.test.com/index.html to https://www.test.com/demo/index.html, but you could not change to https://www.newdomain.com/index.html.


 ​ (https://success.salesforce.com/ideaView?id=08730000000DgZcAAK)