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
sales.forcesales.force 

How do I set a different Canvas App URL for each VF page

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'
    app.setCanvasUrlPath('/#/site/ManagerPage?:iid=1');
}
 
}


VF Page

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



PS: Iframe is not an option for resolving this.

Santhosh Kumar BhojanSanthosh Kumar Bhojan
Hi ,
Did you find any solution for the above scenario ?I am stuck with the same requirement as well.