I am trying to open a VF page in community site and in Salesforce using same custom button added on Opportunity Layout. I tried multiple ways to achieve this, but nothing working as expected.
Community is setup with sub-domain 'test': https://test-sandbox-developer-edition.cs114.force.com/test
- {!$Site.Prefix}/apex/vfpage?id={!Opportunity.Id}
This is working fine in salesforce, but in Community it is throwing error
You have sent us an Illegal URL or an improperly formatted request. %2Fpartners/apex/vfpage?id=xxxxxxxxxxxxxx
- {!URLFOR($Site.Prefix+'/apex/vfpage?id='+Opportunity.Id, null, null, false)}
This is working fine in both salesforce and community, but loading vf page in an iframe which is causing some redirection issue while performing actions on the page (like back action)
- {!SUBSTITUTE($Site.Prefix, '/','')}/apex/vfpage?id={!Opportunity.Id}
This is working again fine in salesforce, but in Community it is throwing error because / is missing before the prefix
prefix/apex/vfpage?id=xxxxxxxxxxxxxx
./apex/vfpage?id={!Opportunity.id}
? (I think this won't work from VF to VF, but if you are outside a VF and want to get inside... it might?)