Hi all, I am attempting to use bracket notation inside of the value attribute of an <apex:dataTable>, but I'm having some issues. The reference works when it's written like so:

<apex:dataTable id="servicesTable" value="{! Contact.RRP_GrantPrograms__r }" var="program" styleClass="table table-striped table-bordered table-hover">

but I receive and Authorization error when written like this:

<apex:dataTable id="servicesTable" value="{! Contact['RRP_GrantPrograms__r'] }" var="program" styleClass="table table-striped table-bordered table-hover">

Is this notation not possible when retrieving child objects, or is there a way that I could make it work?

My goal is to retrieve all objects with a relationship to Contact and use <apex:repeat> to generate a table for them.

EDIT: Added error message.

Authorization Required

You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.

EDIT 2: Converted the Force.com Site to a Community and edited the Exception template to show ErrorDescription to produce a more informative error.

Error: SObject row was retrieved via SOQL without querying the requested field: Contact.RRP_GrantPrograms__r

  • 1
    Can you edit your question to include the text of the error message? – battery.cord Sep 27 '17 at 16:49
  • Are you including this page in a Force.com Site or a page in a Community? – Adrian Larson Sep 27 '17 at 16:52
  • It's a Force.com site. – NorianNyx Sep 27 '17 at 16:54
  • And you checked both syntax options in the site? Or one in your site and one while logged in? – Adrian Larson Sep 27 '17 at 16:58
  • I apologize, I'm note aware of any syntax options (this is my first project with Salesforce), but it's worth noting that I use bracket notation to reference a key earlier in the page. – NorianNyx Sep 27 '17 at 17:00

Your Answer

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

Browse other questions tagged or ask your own question.