+ Start a Discussion
TehNrdTehNrd 

Communities/Sites make it URL buttons not work

It would appear if a customer is using Communities or force.com sites there is no way to build scalable custom object URL buttons that work everywhere.

 

Let's say on the Account object you have a custom URL button that opens a Visualforce page with the following text:

 

/apex/findNearby?id={!Account.Id}

In this example we can't make the Content Source of the button Visualforce as this findNearby.page does not use a standard controller or extension.

 

For a normal user inside salesforce.com this works fine but let's say an org has a Community named 'customers'. This is were things start to break. That link should then redirect to:

 

/customers/apex/findNearby?id={!Account.Id}

 

So you might be thinking, no problem, just use the $Site global variable and do the following in the URL button:

 

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.

This would normally work but here is the final caveat...this is part of a managed packaged that needs to support Group and Professional editions and in these editions the $Site var does not exists.

 

Unless I am missing something this seems to be a gap in functionality for creating URL button links with Communities.

 

Is there anyway, within a button to detect the correct url or salesforce version and build the appropriate URL?

 

Thanks,

Jason

Best Answer chosen by TehNrd
TehNrdTehNrd
Even though $Site.Prefix is not support directly in a Group Edition org, if this is included in a manged package it works without issue. So this below does indeed work.

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.

All Answers

Vinita_SFDCVinita_SFDC

Hello Jason,

 

If the custom button is using URL hack to pre-populate field values, it is not officially supported by salesforce.

 

Refer: https://help.salesforce.com/apex/HTViewHelpDoc?id=custom_url_add.htm&language=en_US

TehNrdTehNrd

I don't understand your reply. This not any type of URL hack to populate input fields.

 

This is simply launching a Visualforce page with a URL parameter, something I can assure you is definitely supported.

TehNrdTehNrd
Even though $Site.Prefix is not support directly in a Group Edition org, if this is included in a manged package it works without issue. So this below does indeed work.

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.
This was selected as the best answer
Keaton KleinKeaton Klein
Hi Jason,
Did you ever get confirmation if this method is officially supported by Salesforce?  Did you have any problems including this in a managed package?