function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
StaciStaci 

custom object lookup to opportunity, get primary contact

I have a custom object that has a lookup to Opportunity.  I have an apex page that renders a pdf. 

I need to get the primary contact of the related opportunity onto the pdf.  I have found and tried this, with no avail.  It gives me an aggregate error:
 Aggregate Relationship is used in an unsupported complex expression containing 'Opportunity__r.opportunitycontactroles'
<apex:outputPanel>
             <apex:repeat value="{!Machine_Quote__c.Opportunity__r.OpportunityContactRoles}" var="opcr" >
                     <apex:outputText rendered="{!opcr.IsPrimary == True}">
                         <td><apex:outputField value="{!opcr.ContactId}"/></td>
                     </apex:outputText>
             </apex:repeat>
             </apex:outputPanel>

Please help??  TIA!