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
Thorsten HeinrichThorsten Heinrich 

Getting Error:Could not resolve field 'OpenActivities' from <apex:outputField> value binding '{!a.OpenActivities}' in page leaddetail

Please help me getting open Activity list on visuaforce page..Here is my code.
// Page

<apex:pageBlock title="Open Activity" >
<apex:pageBlockTable value="{!ActivityList}" var="a">
<apex:column value="{!a.OpenActivities }"/>
</apex:pageBlockTable> </apex:pageBlock>

//Controller method

public List<Lead_Inspector__c>getActivityList(){ List<Lead_Inspector__c> lst =[SELECT (SELECT ActivityDate, Description FROM OpenActivities ORDER BY ActivityDate ASC NULLS LAST, LastModifiedDate DESC      LIMIT 500)FROM Lead_Inspector__c WHERE id = :leadId ];
return lst; }
 
Best Answer chosen by Thorsten Heinrich
ShivaKrishna(Freelancer)ShivaKrishna(Freelancer)
Hi there,

Relation is fine. but issue is you are refering {!a.OpenActivities } for <apex:column  which does not support
 {!a.OpenActivities } is basically as per you query returns list of OpenActivities but <apex:column expects a field

you can do some thing like below

<apex:pageBlock title="Open Activity" >
<apex:pageBlockTable value="{!ActivityList}" var="a">
<apex:repeat value="{!a.OpenActivities }" var="b">
<apex:column value="{!b.ActivityDate}"/>
<apex:column value="{!b.Description }"/>
</aepx:repeat>
</apex:pageBlockTable> </apex:pageBlock>

this snippet for your reference as I dont know what exaclty you wnat to keep inside the table.

let me know, if it helps you or need any help :)

shiva.sfdc.backup@gmail.com
 

All Answers

Recapify DeveloperRecapify Developer
try "OpenActivity"? insead of "OpenActivities"?
Thorsten HeinrichThorsten Heinrich
It throws error :Didn't understand relationship 'OpenActivity
please specify the change where to do this exactly in the code..
ShivaKrishna(Freelancer)ShivaKrishna(Freelancer)
Hi there,

Relation is fine. but issue is you are refering {!a.OpenActivities } for <apex:column  which does not support
 {!a.OpenActivities } is basically as per you query returns list of OpenActivities but <apex:column expects a field

you can do some thing like below

<apex:pageBlock title="Open Activity" >
<apex:pageBlockTable value="{!ActivityList}" var="a">
<apex:repeat value="{!a.OpenActivities }" var="b">
<apex:column value="{!b.ActivityDate}"/>
<apex:column value="{!b.Description }"/>
</aepx:repeat>
</apex:pageBlockTable> </apex:pageBlock>

this snippet for your reference as I dont know what exaclty you wnat to keep inside the table.

let me know, if it helps you or need any help :)

shiva.sfdc.backup@gmail.com
 
This was selected as the best answer
Thorsten HeinrichThorsten Heinrich
Thanks a lot Shiva !
Thorsten HeinrichThorsten Heinrich
one small issue still thr..not able to show column header like subject,activitydate within repeat