-2

I know this should be a piece of cake but I am not a developer and just started today learning Apex. I have created an Apex class that supposedly grabs my current Salesforce URL instance then passes the variable into my VF page. After grabbing the instance of the URL, I am trying to append the rest of the restOfMyDomain link for the Object. I plan on doing this for multiple objects so once I get the first one down, the rest is set sail.

I have run into the error: Unknown property 'getInstance.link' when I get go to my VF page.

Here is my Apex class:

public Class getInstance {

public String link;
public String getLink(String link) {
    link = URL.getSalesforceBaseUrl().toExternalForm();
    return link;
}

}

And here is my VF page code:

<apex:page controller="getInstance">
  <apex:variable var="string" value="{!link}"/>
  <apex:outputLink value="string + restOfMyDomain" id="groupLink"> Groups - UI</apex:outputLink>
</apex:page>
0
1

If you want a controller property to be accessible in your VisualForce Page, it needs a getter. Typically, you would declare it thus:

public String link { get; private set; }

Alternatively, you can add this method:

public String getLink() { return link; }

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