views:

154

answers:

1

I'm writing a VisualForce page to replace an old legacy S-Control.

Originally the Custom S-Control was launched from a Custom Button, and it opened in a new browser window (The S-Control is type HTML, and the Custom Button has Behavior: Display in new window)

For certain old records, I want to do a similar thing from VisualForce.

So: Do HTML S-Controls have a URL that I can launch using a link? In which case, how do I figure out the URL?

Or:

Is there a way of embedding 'Custom Buttons' (that is, the buttons defined in "Setup->Customise->Account->Buttons and Links") into VisualForce pages? If so, I can embed the existing button that knows how to open the S-Control

Or:

Can you suggest some other way of doing this? Key features: Open an S-Control in a new window from VisualForce.

Thanks

+1  A: 

Got an answer from this forum post courtesy of aballard:

Basically, the !Urlfor() function can be used to get the URL of an S-Control. So, you can use an outputLink like this:

<apex:outputLink value="{!UrlFor($SControl.my_scontrol_name)}" 
    target="_blank">Show SControl</apex:outputLink>

If you need to pass an object ID to the S-Control, you can add a second parameter that calls a propery on the custom controller, e.g:

<apex:outputLink value="{!UrlFor($SControl.my_scontrol_name, AccountID)}"
    target="_blank">Show SControl</apex:outputLink>

... where AccountID is defined on the custom controller as public string getAccountID()

See also this blog post at SalesforceSource for more info on the UrlFor function.

codeulike

related questions