1

I'm trying to add the 'Order Product History' related list for an OrderItem (aka 'Order Product') to a Visualforce page that uses 'OrderItem' as the standardController:

<apex:page showHeader="true" sidebar="true" standardController="OrderItem">
    <apex:relatedList list="OrderItemHistories" />
</apex:page>

This give a runtime error that the 'list' parameter is incorrect. Does anyone know what the correct 'list' parameter is?

Here is a quick screenshot of the related list I am trying to add:

Standard 'Order Product' page with Order Product History related list

  • Typically it is the relationshipName for the relationship. Have you tried just OrderItems – pchittum Apr 29 '15 at 22:24
  • Tested it out quickly, and it works...just added the answer below. – pchittum Apr 29 '15 at 22:44
  • 1
    That doesn't always work. For instance see ActivityHistory. – Adrian Larson Apr 29 '15 at 22:49
2

When using the apex:relatedList visualforce tag, you need to use the relationshipName value in the describe data for that object.

Order Describe of Order Item Child Relationship

The above screenshot shows OrderItem with the child relationship name of OrderItems

So this should work:

<apex:relatedList list="OrderItems"/>

In some instances, apex:relatedList does not support certain standard child relationships. For instance the Field History related list has a value of Histories for the relationshipName describe property for all objects, but if used you will receive this exception:

'Histories' is not a valid child relationship name for entity Order

There doesn't seem to be a clear delineation between what is and isn't supported amongst standard related lists, but all custom ones are.

  • 1
    Are you saying that this related list is not supported? – Jason Hartfield Apr 29 '15 at 23:15

Your Answer

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

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