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
Val Grasparil 4Val Grasparil 4 

Visualforce Component domain issue

I have created a Component that can lives on my Account, Contact, and Opportunity objects. WIthin the page i have a few outputPanels that allow for creation, editing, and list view of a Custom Object. On the List View, i have a link that will redirect the user to a different page.

When the Account object first loads my link is:
https://c.cs22.visual.force.com/apex/RelationshipListView

If i edit or create a new Custom Object, on the Save the URL will be:
https://vs.cs22.visual.force.com/apex/RelationshipListView

When i click the link with vs, as you would expect it gives me page not found error. Once i refresh my Account page though, the link will be correct, and route me to my intended page.

From what i have read, VFPs are hosted on a different domain, https://vs. rather than https://c.

Any ideas on how to fix this issue?

Best Answer chosen by Val Grasparil 4
Val Grasparil 4Val Grasparil 4
Created a propery that would get my base URL and explicitly set my URL rather than letting it be a relative path.

Controller:
    public String getBaseUrl(){
        return URL.getSalesforceBaseUrl().toExternalForm();
    }