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
ckellieckellie 

Visualforce Link to work in any community and the ui

I am depolying the partner community and have found that my visualforce page buttons and links do not work in the communities. I need to write this link to work in any community and the standard Salesforce UI:

/apex/quoterequestredirectguidance?oppid=' + oppid + '&CANCELurl=/' + oppid

In communities I have learned that the url needs to start with the community name as in:
<community name>/quoterequestredirectguidance?oppid=' + oppid + '&CANCELurl=/' + oppid

How do I write the above link where the apex code will determinet whether the user is in a community or the standard ui, then insert the correct label in url? Ideally I would like to create one link that will work in any community or non-community environment?

Thank you
ShashankShashank (Salesforce Developers) 
You can probably base it on the user type of the user who is accessing the page. Please see this: https://developer.salesforce.com/forums?id=906F0000000AeAAIA0