0

I've a Hyperlink formula field in an object like '/apex/testPage?id=xxxx' When I'll click, this will go an open 'www.domain.force.com/apex/testPage?id=xxxx'

I want to redirect same link in Sites to

'www.domain.force.com/SITE_PATH/apex/testPage?id=xxxx'

I wanted a SitePath to be prepend in following formula outcome -

HYPERLINK('/apex/testPage?id=xxxx') if in sites, otherwise as /apex/testPage?id=xxxx.

I am able to achieve this as -

HYPERLINK(
        LEFT(
                $Api.Partner_Server_URL_260,
                FIND('/services',$Api.Partner_Server_URL_260)
            )
        +'apex/testPage?id=xxx
    ) 

How we can achieve this

0

It's a bit unclear exactly which one you'll want to use to get the proper SITE_PATH as I'm uncertain of the context you're asking your question. All the different variations on the usage of the $SITE variables are explained on this page of the Visualforce documentation and there are many different ones you could use depending on the context.

  • I wanted a SitePath to be prepend in following formula outcome - HYPERLINK('/apex/testPage?id=xxxx') if in sites, otherwise as '/apex/testPage?id=xxxx'. I am able to achieve this as - HYPERLINK(LEFT($Api.Partner_Server_URL_260, FIND( '/services', $Api.Partner_Server_URL_260))+'/apex/testPage?id=xxxx') – RSG Sep 26 '17 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.