+ Start a Discussion

External Objects (beta) - Can't Pass Id to VF page via button?

I'm trying to use the new External Objects (beta), and have a custom VF page for the object.

When I try to add a button to the standard page layout, I don't see a way to pass the record Id.  If I try to use a URL for a custom button, I can't add any fields from my External Object (e.g. MyObject__x.Id).  If I just use a Visualforce page, the record is not passed through in the link.

I realize this is in beta, so there might not be many people using this yet, but if anyone else is struggling with this, would be curious to hear.

Hi AJ, 

How have you defined the controller for the External Object?

Try this:

create a variable in your controller

public String selectedLetterID {get;set;}

Then set it with the param tag.

<apex:inputfield value="{!letter.Suppressed__c}" id="suppressBox" onclick="SupressLetter('{!letter.Id}');return false;"/>

<apex:actionFunction name="SupressLetter" action="{!suppressLetter}" rerender="out">
    <apex:param name="firstparam" assignto="{!selectedLetterID}" value="" />

Then update your record based on the id that is now assigned to your new variable in your controller method.