You need to sign in to do that
Don't have an account?
Marcio Zima.ax1538
How to query <OpenActivity> with Account Name?
Hi everyone,
I have been using the following apex code to select information about Task:
public List<OpenActivity> getOpen()
{
SObject[] Cuenta = [SELECT Name,
(SELECT Account.Name, What.Name, Who.Name, Account.Id, Id, IsAllDayEvent, OwnerId, CallDurationInSeconds, CallObject, CallDisposition, CallType, Close_task__c, IsClosed, Closed_Date__c, Description, WhoId, CreatedById, CreatedDate, Data_Quality_Description__c, Data_Quality_Score__c, ActivityDate, IsDeleted, DurationInMinutes, LastModifiedById, LastModifiedDate, Location, WhatId, Priority, ReminderDateTime, IsReminderSet, Status, Subject, SystemModstamp, IsTask, ActivityType, WhatIdCode__c FROM OpenActivities)
From CustomObj__c WHERE id=:cntact.Id];
Actividades = (List<OpenActivity>)Cuenta.get(0).getSObjects('OpenActivities');
return Actividades;
}
And my Visualforce Page:
<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!each.id}?retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
{!each.Subject}
</apex:outputLink>
</apex:column>
<apex:column headerValue="Name">{!each.Who}</apex:column>
<apex:column headerValue="Assigned To">{!each.WhatId}</apex:column>
<apex:column headerValue="Due Date">{!each.ActivityDate}</apex:column>
<apex:column headerValue="Status">{!each.Status}</apex:column>
<apex:column headerValue="Priority">{!each.Priority}</apex:column>
<apex:column headerValue="OwnerId">{!each.OwnerId}</apex:column>
<apex:column headerValue="Action">
<apex:outputLink value="/{!each.id}/e?retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
Edit
</apex:outputLink>
|
<apex:outputLink value="/{!each.id}/e?close=1&retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
Close
</apex:outputLink>
</apex:column>
</apex:dataTable>
The problem is that when I try to show the name of the Accounts. It's showing the ID instead of Name. I tried {!each.Who.Name}, but it appeared blank.
Any suggestion to solve this?
I have been using the following apex code to select information about Task:
public List<OpenActivity> getOpen()
{
SObject[] Cuenta = [SELECT Name,
(SELECT Account.Name, What.Name, Who.Name, Account.Id, Id, IsAllDayEvent, OwnerId, CallDurationInSeconds, CallObject, CallDisposition, CallType, Close_task__c, IsClosed, Closed_Date__c, Description, WhoId, CreatedById, CreatedDate, Data_Quality_Description__c, Data_Quality_Score__c, ActivityDate, IsDeleted, DurationInMinutes, LastModifiedById, LastModifiedDate, Location, WhatId, Priority, ReminderDateTime, IsReminderSet, Status, Subject, SystemModstamp, IsTask, ActivityType, WhatIdCode__c FROM OpenActivities)
From CustomObj__c WHERE id=:cntact.Id];
Actividades = (List<OpenActivity>)Cuenta.get(0).getSObjects('OpenActivities');
return Actividades;
}
And my Visualforce Page:
<apex:dataTable value="{!Open}" var="each" cellpadding="10" border="0" styleClass="list">
<apex:column headerValue="Subject">
<apex:outputLink value="/{!each.id}?retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
{!each.Subject}
</apex:outputLink>
</apex:column>
<apex:column headerValue="Name">{!each.Who}</apex:column>
<apex:column headerValue="Assigned To">{!each.WhatId}</apex:column>
<apex:column headerValue="Due Date">{!each.ActivityDate}</apex:column>
<apex:column headerValue="Status">{!each.Status}</apex:column>
<apex:column headerValue="Priority">{!each.Priority}</apex:column>
<apex:column headerValue="OwnerId">{!each.OwnerId}</apex:column>
<apex:column headerValue="Action">
<apex:outputLink value="/{!each.id}/e?retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
Edit
</apex:outputLink>
|
<apex:outputLink value="/{!each.id}/e?close=1&retURL=%2Fapex%2Ftestpage3%3Fid%3D{!id}">
Close
</apex:outputLink>
</apex:column>
</apex:dataTable>
The problem is that when I try to show the name of the Accounts. It's showing the ID instead of Name. I tried {!each.Who.Name}, but it appeared blank.
Any suggestion to solve this?
Did you try this,
SELECT AccountId, ActivityDate FROM Event where AccountID=15digit i
Regards,
Ashish