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
jjayomajjayoma 

SObject row was retrieved via SOQL without querying the requested field: Task.Status Error

Hi guys, I created a visualforce email template but I'm Stack with the error that says "Object row was retrieved via SOQL without querying the requested field: Task.Status"

 

I'm stack with this one I need your help please.

 

Below are the Complete codes:

 

<messaging:emailTemplate recipientType="Contact"
relatedToType="Calls__c"
subject="Meeting Minutes: {!relatedTo.Account__r.name}-{!relatedTo.Call_Date__c}"
replyTo="support@acme.com">
<messaging:htmlEmailBody >
<html>
<style type="text/css">
body{

border-width: 2px;
border-style: dashed;
border-size: 2px;
border-color: blue;
background-color: #CCCCCC;
}

table
{
border-width: 5px;
border-spacing: 5px;
border-style: dashed;
border-color: #FF0000;
background-color: #FFFFFF;
}
td
{
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #000000;
background-color: #FFEECC;
}
th
{
color: #000000;
border-width: 1px ;
padding: 4px ;
border-style: solid ;
border-color: #000000;
background-color: #FFFFF0;
}

</style>
<body>

<apex:image id="Logo" value="https://bluescope--bsldevsb--c.cs6.content.force.com/servlet/servlet.FileDownload?file=015N00000008vTW" height="64" width="90"/>
<table border="2">
<center>
<p>Meeting Minutes with {!relatedTo.Account__r.name},</p>
</center>
<p>Meeting Date &nbsp; &nbsp;<apex:outputText value="{0,date,M/d/yyyy }"> <apex:param value="{!relatedTo.Call_Date__c}" /> </apex:outputText> .</p>
<p>Location: {!relatedTo.Location__c}.</p>
<p>BlueScope Steel representative: {!relatedTo.Owner.Name}.</p>

<p/><p/>
<p>Meeting Summary:
{!relatedTo.Meeting_Summary__c}
</p>

<p/><p/><p/>

<center><b>Open Activities</b></center>
<center>
<table border="2">
<tr>
<th>Owner</th>
<th>Subject</th>
<th>&nbsp;&nbsp;ActivityDate</th>
<th>&nbsp;&nbsp;Status</th>
</tr>
<apex:repeat value="{!relatedTo.Tasks}" var="cx">
<tr>
<td style="text-align:right; display:{!if (cx.Status=='Completed' && cx.Visible_to_Customer__c==true,'none','table-column')}">{!cx.Owner.name}</td>
<td style="text-align:right; display:{!if (cx.Status=='Completed' && cx.Visible_to_Customer__c==true,'none','table-column')}">{!cx.Subject}</td>
<td style="text-align:right; display:{!if (cx.Status=='Completed' && cx.Visible_to_Customer__c==true,'none','table-column')}"><apex:outputText value="{0,date,M/d/yyyy }"> <apex:param value="{!cx.ActivityDate}" /> </apex:outputText></td>
<td style="text-align:right; display:{!if (cx.Status=='Completed' && cx.Visible_to_Customer__c==true,'none','table-column')}">&nbsp;&nbsp;{!cx.Status}</td>
</tr>
</apex:repeat>
</table>
</center>

<p>
Should you have any questions, please feel free to contact me.
</p>
<p>
Regards,
</p>
{!relatedTo.Owner.Name}
<p/>
<center>
<apex:outputLink value="http://www.salesforce.com">
For more detailed information login to Salesforce.com
</apex:outputLink>
</center>
</table>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

nick1505nick1505

Hi,

 

The error is because the staus field from Task object is not included in the query. Include the status field in the query for Task and it will resolve your issue.