• Santhosh Kumar Bhojan
  • 0 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2
Hi ,

I have an canvas app where able to connect to some external application for displaying some reports which works perfectly .But I do need to show different URL on a single page (5 sections with different URLs) where I am able to construct the URL at the controller but not sure how do I need to call in my visualforce page.Appreciate your help on the same.


public class MyCanvasLifecycleHandler implements Canvas.CanvasLifecycleHandler {

public Set<Canvas.ContextTypeEnum> excludeContextTypes(){
Set<Canvas.ContextTypeEnum> excluded = new Set<Canvas.ContextTypeEnum>();

return excluded;
public void onRender(Canvas.RenderContext renderContext) {
// Code goes here to customize behavior when the app is rendered

Canvas.ApplicationContext app = renderContext.getApplicationContext();
Canvas.EnvironmentContext env = renderContext.getEnvironmentContext();

URL url = new URL(app.getCanvasUrl());

System.debug('Check URL is ::' +url);

//No Of Rentals:
System.debug('Controller finalURL: 1 ' + app.getCanvasUrl());

//Expenditure T&M:

System.debug('Controller finalURL: 2 ' +app.getCanvasUrl());


Visualforce Page:

<apex:page controller="MyCanvasLifecycleHandler" >
 <apex:canvasApp developerName="avis" height="400px" width="750px" canvasId="NoOfRentals" id="NoOfRentals" onCanvasAppLoad="NoOfRentals" containerId=""  />
<apex:canvasApp developerName="avis" height="400px" width="750px" canvasId="ExpenditureT" id="ExpenditureT" onCanvasAppLoad="ExpenditureT" />


Appreciate  your help on the same.
I have a Canvas app connected to my Salesforce. It works perfectly and passes the user SSO credentials through to the app which opens on a Tab in Salesforce. I'll call this "www.landingpage.com"

I now have a requirement for tab A to display www.landingpage.com/ManagerPage and Tab B to show www.landingpage.com/AssociatePage

I do not see anything in the documention that clearly shows how to set this up. Based on my research I think I need to use the setCanvasUrlPath(newPath) method but am struggling with how to apply this method to my VF page which calls the "CanvasApp".

 When I add the controller to my VF page it continues to return the main canvas page instead of the specific url.

Here is what I have now:
public class CanvasHandler {

public void onRender(Canvas.RenderContext renderContext) {

    // Get the Application and Environment context from the RenderContext
    Canvas.ApplicationContext app = renderContext.getApplicationContext();
    Canvas.EnvironmentContext env = renderContext.getEnvironmentContext();

    // Override Canvas app URL to direct user to the Manager page instead of the default page'

VF Page

<apex:page controller="CanvasHandler" lightningStylesheets="true">  
  <apex:sectionHeader />
      <apex:canvasApp applicationName="Reports" height="1900px" Width="1000px" Scrolling="false"/>  

PS: Iframe is not an option for resolving this.

I have an application running in Canvas that uses something.com as the Canvas App URL.
For legal reasons based on user input I have to redirect to a different server like
or continue on

The problem is that when I redirect inside my app the redirect from canvas always pops up (navigates away from salesforce.com to a.something.com or b.something.com).

The only solution i see now is to create 2 more visualforce pages that contain one canvas app ( each that has these addresses in the callback.
This way via the visualforce javascript proxy I redirect to the page that has Canvas app A or Canvas app B  and the user may continue working inside the canvas app at everything looks natural (even though there is a redirect and canvas app loading its all looks the same (same tab same layout etc)).

This solution has:
1 App
Something - contains tabs that contain the canvas app pointing to something.com as well as other tabs and static pages (I would like to show only this in the app selection dropdown)

3 Connected Apps
Canvas app Something - canvas app pointing to something.com
Canvas app A_Something - canvas app pointing to a.something.com
Canvas app B_Something - canvas app pointing to b.something.com

But its unintuituve for the user that they see 3 apps in the upper right corner app selection dropdown.

1. Is there a way to use different servers in one Canvas app so I can redirect in the same canvas app to different domains?
2. Of not is there a way to hide the Canvas app A_Something and Canvas app B_Something from showing in the app selection?

I spent about 12 hours looking for the solution :(