4

I have a simple Visualforce page that has the following:

<apex:page standardController="Account">
   <apex:outputField value="{!Account.Name}"/><br />
   <apex:relatedList subject="{!Account.Contacts}" list="AccountContactRoles"/>
</apex:page>

When I navigate to the page it gives me the following error.

Unable to Access Page

The value of the "id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.

I am specifying a valid Account ID in the URL:

https://c.na14.visual.force.com/apex/contacts?id=001d000000VtORJ 

When I remove the <apex:relatedList> the page renders with the Account Name correctly.

Is there some other parameter or value that I need for the <apex:relatedList> when used with a child? I don't ever remember needing anything else.

I'm in a DE that is Winter '13.

3
  • I removed the Subject Attribute and tried. It worked. Dont know what that means, but just FYI. Feb 7, 2013 at 11:41
  • 2
    In your example i think you need to correct {!Account.Contacts} to {!Account.Contacts[0]} because apex:relatedList subject expected ID value of the record. I have tried this, but then I got another problem: 'AccountContactRoles' is not a valid child relationship name for entity Contact. After research i found that AccountContactRoles related list on the Contact object is not visible for some reason :( Here some info: boards.developerforce.com/t5/Best-Practices-Discussion/… Feb 7, 2013 at 12:42
  • @mast0r - Thanks! That's interesting... Feb 7, 2013 at 12:56

1 Answer 1

4

My error...what I really wanted was the related list of each contact. Something like the following:

<apex:page standardController="Account">
       <apex:outputField value="{!Account.Name}"/><br />
       <apex:repeat value="{!Account.Contacts}" var="contact">
           <apex:outputText value="{!contact.Name}"/>
           <apex:relatedList subject="{!contact}" list="AccountContactRoles"/>
       </apex:repeat>
</apex:page>

I was incorrectly specifying a List as the subject, when I needed an object.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .