Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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.

share|improve this question
    
I removed the Subject Attribute and tried. It worked. Dont know what that means, but just FYI. –  Shailesh Deshpande Feb 7 '13 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/… –  mast0r Feb 7 '13 at 12:42
    
@mast0r - Thanks! That's interesting... –  Peter Knolle Feb 7 '13 at 12:56

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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