You need to sign in to do that
Don't have an account?
kezia dola
common.apex.runtime.impl.executionexception: sobject row was retrieved via soql without querying the requested field: order.ordernumber
Hi All,
I have created a visual force page to create a pdf in order object. Earlier it was worked fine but now I am facing this error:
"common.apex.runtime.impl.executionexception: sobject row was retrieved via soql without querying the requested field: order.ordernumber"
Here is my controller:
public class OrderPdf {
public Order ord{set;get;}
public OrderItem ordIt{set;get;}
public Organization org{set;get;}
public string rec;
public OrderPdf(apexpages.StandardController sc){
rec=apexpages.currentPage().getparameters().get('id');
ord = [SELECT ID,AccountId,Customer_PO_Date__c,Customer_PO_Number__c,Delivery_Terms__c,Incoterms_2010_named_place__c,Payment_Terms__c,Port_of_Arrival__c,CurrencyIsoCode,Name,OrderNumber,EffectiveDate,Ship_Via__c,Supplier_Number__c,Account.CIN__c,Account.Email__c,Account.Phone,BillToContact.Email,BillToContact.Phone,TotalAmount,BillToContact.FirstName,BillToContact.LastName,account.name,account.billingcountry,account.billingcity,account.billingstate,account.billingPostalCode,account.billingStreet,account.shippingcountry,account.shippingcity,account.shippingstate,account.shippingPostalCode,
account.shippingStreet,(select Product2Id,Product2.Name,OrderItemNumber,Product2.Description,Total_Price_Incl_GST__c,Quantity,Delivery_Date__c,HSN_Code__c,CAS_No__c,UOM__c,Description,UnitPrice,TotalPrice from orderItems) from order where id =: rec];
}
public pagereference SaveFile(){
PageReference pdf = Page.OrderPDFAttachement;
pdf.getParameters().put('id',rec);
pdf.setRedirect(true);
blob body =Test.isRunningTest() ? Blob.valueOf('UNIT.TEST'):pdf.getContentAsPDF();
string filename = ' My File Name ';
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'Attachment.pdf'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = String.valueOf('SOMU '+ string.valueof(system.today().format())+'.pdf'); // Display name of the files
conVer.VersionData = body; // converting your binary string to Blog
insert conVer;
Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;
ContentDocumentLink cDe = new ContentDocumentLink();
cDe.ContentDocumentId = conDoc;
cDe.LinkedEntityId =rec; // you can use objectId,GroupId etc
//cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
//cDe.Visibility = 'System Administrator';
insert cDe;
pagereference p=new pagereference('/'+rec);
return p;
}
public pagereference SendFile(){
PageReference pdf = Page.OrderPdf;
pdf.getParameters().put('id',rec);
// Blob b =pdf.getContentAsPDF();
Blob b =Test.isRunningTest() ? Blob.valueOf('UNIT.TEST'):pdf.getContentAsPDF();
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'Attachment.pdf'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = String.valueOf('SOMU '+ string.valueof(system.today().format())+'.pdf'); // Display name of the files
conVer.VersionData = b; // converting your binary string to Blog
insert conVer;
Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;
//Create ContentDocumentLink
ContentDocumentLink cDe = new ContentDocumentLink();
cDe.ContentDocumentId = conDoc;
cDe.LinkedEntityId =rec; // you can use objectId,GroupId etc
//cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
//cDe.Visibility = 'System Administrator';
insert cDe;
pagereference p=new pagereference('/'+rec);
return p;
}
}
---------------------------------------------------------------------------------------------
Visualforce page:
<apex:page extensions="OrderPdf" renderas="pdf" standardController="order" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
<head>
<style type="text/css">
@page{
size:21cm 29.7cm;
@bottom-right{
content:"Page " counter(page) " of " counter(pages);
}
}
</style>
<img src="https://somugroup--dev1.sandbox.file.force.com/servlet/servlet.FileDownload?file=0151s000000E4iq" style="background-color:#D3D3D3; width: 90px; height: 50px" align="left" /> <br/>
</head>
<tr>
<td colspan= "2" align="left"> <br/> <span style="font-size: 14px;"><b>Contact: {!ord.BillToContact.FirstName}{!ord.BillToContact.LastName}</b></span></td>
<td style="font-size: 15px;text-align: right" width="5%"> <b>Order:{!ord.OrderNumber} </b><br/></td>
</tr>
<table style="width:100%" border="0" cellspacing="0">
<tbody>
<tr>
<td colspan= "2" align="left"> <br/> <span style="font-size: 14px;"><b>{!ord.account.name}</b></span></td>
</tr>
<tr><td >
<span style="font-size: 15px;">{!ord.account.billingStreet}<br/>{!ord.account.billingcity}<br/>{!ord.account.billingstate}<br/>{!ord.account.billingPostalCode}<br/>{!ord.account.billingcountry}<br/>CIN#: {!ord.Account.CIN__c}<br/>Email: {!ord.Account.Email__c}<br/>Phone: {!ord.Account.Phone}<br/> </span><br/>
</td>
<table style="width:10%" border="1" cellspacing="0" align="right">
<tr>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Type</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Order</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Order Date</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Revision Date</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Buyer</b><br/></td>
</tr>
<apex:repeat value="{!Order}" var="ort">
<tr>
<td style="font-size: 12px;" align="left" >Standard Purchase Order </td>
<td style="font-size: 12px;" align="left"> {!ort.OrderNumber}</td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!ort.EffectiveDate}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!ort.PoDate}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left" >SP </td>
</tr>
</apex:repeat>
</table>
</tr>
<br/>
<td >
<span style="font-size: 15px;text-align: right"> <b>Somu Group Of Companies </b></span><br/>
<span style="font-size: 15px;text-align: right"> <b>No.20,Somu Centre,29th Main,BTM Layout, </b></span><br/>
<span style="font-size: 15px;text-align: right"> <b>2nd Stage </b></span><br/>
<span style="font-size: 15px;text-align: right"> Bangalore 560076</span><br/>
<span style="font-size: 15px;text-align: right"> Karnataka </span><br/>
<span style="font-size: 15px;text-align: right"> India </span><br/><br/>
</td>
<tr>
<td colspan= "3" align="left"> </td>
</tr>
<tr><td >
<span style="font-size: 15px;"><b>Deliver To : </b> <br/>
<span style="font-size: 15px;">{!ord.account.shippingStreet}<br/>{!ord.account.shippingcity}<br/>{!ord.account.shippingstate}<br/>{!ord.account.shippingPostalCode}<br/>{!ord.account.shippingcountry}<br/> </span><br/>
</span><br/> </td><td >
<span style="font-size: 15px;text-align: right"> <b> Bill To : </b></span><br/>
<span style="font-size: 15px;"> {!ord.account.billingStreet}<br/> {!ord.account.billingcity}<br/> {!ord.account.billingstate}<br/> {!ord.account.billingPostalCode}<br/> {!ord.account.billingcountry}<br/> </span><br/> </td>
</tr>
</tbody>
</table>
<br/> <table style="width:100%" border="1" cellspacing="0">
<tr>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Account Number</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Supplier Number</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Payment Terms</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Currency</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Inncoterms 2010 named place</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Ship via</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Port of Arrival</b></td>
</tr>
<apex:repeat value="{!Order}" var="ort">
<tr>
<td style="font-size: 12px;" align="left" >{!ort.account.name} </td>
<td style="font-size: 12px;" align="left">{!ort.Supplier_Number__c} </td>
<td style="font-size: 12px;" align="left">{!ort.Payment_Terms__c} </td>
<td style="font-size: 12px;" align="left">{!ort.CurrencyIsoCode} </td>
<td style="font-size: 12px;" align="left" >{!ort.Incoterms_2010_named_place__c} </td>
<td style="font-size: 12px;" align="left" >{!ort.Ship_Via__c} </td>
<td style="font-size: 12px;" align="left">{!ort.Port_of_Arrival__c} </td>
</tr>
</apex:repeat>
</table>
<br/> <table style="width:100%" border="1">
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Confirm To: {!ord.BillToContact.FirstName}{!ord.BillToContact.LastName}</b><br/> </td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Email: {!ord.BillToContact.Email}</b><br/> </td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Phone: {!ord.BillToContact.Phone}</b><br/> </td>
</table>
<br/> <table style="width:100%" border="1" cellspacing="0">
<tr>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Product</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Delivery Date</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Qunatity</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>UOM</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>CAS No</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>HSN Code</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Unit Price</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Amount</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="30%"><b>Product Description</b><br/></td>
</tr>
<apex:repeat value="{!ord.orderItems}" var="o">
<tr>
<td style="font-size: 12px;" align="left" >{!o.Product2.Name} </td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!o.Delivery_Date__c}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left"><apex:outputText value="{0, number, ###,###}">
<apex:param value="{!o.Quantity}" />
</apex:outputText><br/></td>
<td style="font-size: 12px;" align="left" >{!o.UOM__c} </td>
<td style="font-size: 12px;" align="left" >{!o.CAS_No__c} </td>
<td style="font-size: 12px;" align="left">{!o.HSN_Code__c} </td>
<td style="font-size: 12px;" align="left">{!o.UnitPrice} </td>
<td style="font-size: 12px;" align="left">{!o.Total_Price_Incl_GST__c} </td>
<td style="font-size: 12px;" align="left">{!o.Product2.Description} </td>
</tr>
</apex:repeat>
<tr>
<td style="font-size: 14px;" colspan="7" align="Right">
<b>Grand Total</b>
</td>
<td style="font-size: 12px;" align="left">{!ord.TotalAmount}
</td>
<td style="font-size: 12px;" align="left">
</td><td style="font-size: 12px;" align="left">
</td>
</tr>
</table>
<table style="width:100%" border="0" cellspacing="0" >
</table>
</apex:page>
Any idea how to avoid this? Even that field was in query.
Thanks,
Kezia
I have created a visual force page to create a pdf in order object. Earlier it was worked fine but now I am facing this error:
"common.apex.runtime.impl.executionexception: sobject row was retrieved via soql without querying the requested field: order.ordernumber"
Here is my controller:
public class OrderPdf {
public Order ord{set;get;}
public OrderItem ordIt{set;get;}
public Organization org{set;get;}
public string rec;
public OrderPdf(apexpages.StandardController sc){
rec=apexpages.currentPage().getparameters().get('id');
ord = [SELECT ID,AccountId,Customer_PO_Date__c,Customer_PO_Number__c,Delivery_Terms__c,Incoterms_2010_named_place__c,Payment_Terms__c,Port_of_Arrival__c,CurrencyIsoCode,Name,OrderNumber,EffectiveDate,Ship_Via__c,Supplier_Number__c,Account.CIN__c,Account.Email__c,Account.Phone,BillToContact.Email,BillToContact.Phone,TotalAmount,BillToContact.FirstName,BillToContact.LastName,account.name,account.billingcountry,account.billingcity,account.billingstate,account.billingPostalCode,account.billingStreet,account.shippingcountry,account.shippingcity,account.shippingstate,account.shippingPostalCode,
account.shippingStreet,(select Product2Id,Product2.Name,OrderItemNumber,Product2.Description,Total_Price_Incl_GST__c,Quantity,Delivery_Date__c,HSN_Code__c,CAS_No__c,UOM__c,Description,UnitPrice,TotalPrice from orderItems) from order where id =: rec];
}
public pagereference SaveFile(){
PageReference pdf = Page.OrderPDFAttachement;
pdf.getParameters().put('id',rec);
pdf.setRedirect(true);
blob body =Test.isRunningTest() ? Blob.valueOf('UNIT.TEST'):pdf.getContentAsPDF();
string filename = ' My File Name ';
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'Attachment.pdf'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = String.valueOf('SOMU '+ string.valueof(system.today().format())+'.pdf'); // Display name of the files
conVer.VersionData = body; // converting your binary string to Blog
insert conVer;
Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;
ContentDocumentLink cDe = new ContentDocumentLink();
cDe.ContentDocumentId = conDoc;
cDe.LinkedEntityId =rec; // you can use objectId,GroupId etc
//cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
//cDe.Visibility = 'System Administrator';
insert cDe;
pagereference p=new pagereference('/'+rec);
return p;
}
public pagereference SendFile(){
PageReference pdf = Page.OrderPdf;
pdf.getParameters().put('id',rec);
// Blob b =pdf.getContentAsPDF();
Blob b =Test.isRunningTest() ? Blob.valueOf('UNIT.TEST'):pdf.getContentAsPDF();
ContentVersion conVer = new ContentVersion();
conVer.ContentLocation = 'S'; // S specify this document is in SF, use E for external files
conVer.PathOnClient = 'Attachment.pdf'; // The files name, extension is very important here which will help the file in preview.
conVer.Title = String.valueOf('SOMU '+ string.valueof(system.today().format())+'.pdf'); // Display name of the files
conVer.VersionData = b; // converting your binary string to Blog
insert conVer;
Id conDoc = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId;
//Create ContentDocumentLink
ContentDocumentLink cDe = new ContentDocumentLink();
cDe.ContentDocumentId = conDoc;
cDe.LinkedEntityId =rec; // you can use objectId,GroupId etc
//cDe.ShareType = 'I'; // Inferred permission, checkout description of ContentDocumentLink object for more details
//cDe.Visibility = 'System Administrator';
insert cDe;
pagereference p=new pagereference('/'+rec);
return p;
}
}
---------------------------------------------------------------------------------------------
Visualforce page:
<apex:page extensions="OrderPdf" renderas="pdf" standardController="order" applyHtmlTag="false" applyBodyTag="false" showHeader="false">
<head>
<style type="text/css">
@page{
size:21cm 29.7cm;
@bottom-right{
content:"Page " counter(page) " of " counter(pages);
}
}
</style>
<img src="https://somugroup--dev1.sandbox.file.force.com/servlet/servlet.FileDownload?file=0151s000000E4iq" style="background-color:#D3D3D3; width: 90px; height: 50px" align="left" /> <br/>
</head>
<tr>
<td colspan= "2" align="left"> <br/> <span style="font-size: 14px;"><b>Contact: {!ord.BillToContact.FirstName}{!ord.BillToContact.LastName}</b></span></td>
<td style="font-size: 15px;text-align: right" width="5%"> <b>Order:{!ord.OrderNumber} </b><br/></td>
</tr>
<table style="width:100%" border="0" cellspacing="0">
<tbody>
<tr>
<td colspan= "2" align="left"> <br/> <span style="font-size: 14px;"><b>{!ord.account.name}</b></span></td>
</tr>
<tr><td >
<span style="font-size: 15px;">{!ord.account.billingStreet}<br/>{!ord.account.billingcity}<br/>{!ord.account.billingstate}<br/>{!ord.account.billingPostalCode}<br/>{!ord.account.billingcountry}<br/>CIN#: {!ord.Account.CIN__c}<br/>Email: {!ord.Account.Email__c}<br/>Phone: {!ord.Account.Phone}<br/> </span><br/>
</td>
<table style="width:10%" border="1" cellspacing="0" align="right">
<tr>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Type</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Order</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Order Date</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Revision Date</b><br/></td>
<td style="font-size: 15px;text-align: center" width="5%"> <b>Buyer</b><br/></td>
</tr>
<apex:repeat value="{!Order}" var="ort">
<tr>
<td style="font-size: 12px;" align="left" >Standard Purchase Order </td>
<td style="font-size: 12px;" align="left"> {!ort.OrderNumber}</td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!ort.EffectiveDate}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!ort.PoDate}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left" >SP </td>
</tr>
</apex:repeat>
</table>
</tr>
<br/>
<td >
<span style="font-size: 15px;text-align: right"> <b>Somu Group Of Companies </b></span><br/>
<span style="font-size: 15px;text-align: right"> <b>No.20,Somu Centre,29th Main,BTM Layout, </b></span><br/>
<span style="font-size: 15px;text-align: right"> <b>2nd Stage </b></span><br/>
<span style="font-size: 15px;text-align: right"> Bangalore 560076</span><br/>
<span style="font-size: 15px;text-align: right"> Karnataka </span><br/>
<span style="font-size: 15px;text-align: right"> India </span><br/><br/>
</td>
<tr>
<td colspan= "3" align="left"> </td>
</tr>
<tr><td >
<span style="font-size: 15px;"><b>Deliver To : </b> <br/>
<span style="font-size: 15px;">{!ord.account.shippingStreet}<br/>{!ord.account.shippingcity}<br/>{!ord.account.shippingstate}<br/>{!ord.account.shippingPostalCode}<br/>{!ord.account.shippingcountry}<br/> </span><br/>
</span><br/> </td><td >
<span style="font-size: 15px;text-align: right"> <b> Bill To : </b></span><br/>
<span style="font-size: 15px;"> {!ord.account.billingStreet}<br/> {!ord.account.billingcity}<br/> {!ord.account.billingstate}<br/> {!ord.account.billingPostalCode}<br/> {!ord.account.billingcountry}<br/> </span><br/> </td>
</tr>
</tbody>
</table>
<br/> <table style="width:100%" border="1" cellspacing="0">
<tr>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Account Number</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Supplier Number</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Payment Terms</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Currency</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Inncoterms 2010 named place</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Ship via</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Port of Arrival</b></td>
</tr>
<apex:repeat value="{!Order}" var="ort">
<tr>
<td style="font-size: 12px;" align="left" >{!ort.account.name} </td>
<td style="font-size: 12px;" align="left">{!ort.Supplier_Number__c} </td>
<td style="font-size: 12px;" align="left">{!ort.Payment_Terms__c} </td>
<td style="font-size: 12px;" align="left">{!ort.CurrencyIsoCode} </td>
<td style="font-size: 12px;" align="left" >{!ort.Incoterms_2010_named_place__c} </td>
<td style="font-size: 12px;" align="left" >{!ort.Ship_Via__c} </td>
<td style="font-size: 12px;" align="left">{!ort.Port_of_Arrival__c} </td>
</tr>
</apex:repeat>
</table>
<br/> <table style="width:100%" border="1">
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Confirm To: {!ord.BillToContact.FirstName}{!ord.BillToContact.LastName}</b><br/> </td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Email: {!ord.BillToContact.Email}</b><br/> </td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="left" width="10%"><b>Phone: {!ord.BillToContact.Phone}</b><br/> </td>
</table>
<br/> <table style="width:100%" border="1" cellspacing="0">
<tr>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Product</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Delivery Date</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Qunatity</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>UOM</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>CAS No</b><br/></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>HSN Code</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Unit Price</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="10%"><b>Amount</b></td>
<td style="background-color:#D3D3D3; font-size: 14px;" align="center" width="30%"><b>Product Description</b><br/></td>
</tr>
<apex:repeat value="{!ord.orderItems}" var="o">
<tr>
<td style="font-size: 12px;" align="left" >{!o.Product2.Name} </td>
<td style="font-size: 12px;" align="left">
<apex:outputText value="{0,date,dd'-'MM'-'yyyy}">
<apex:param value="{!o.Delivery_Date__c}" />
</apex:outputText></td>
<td style="font-size: 12px;" align="left"><apex:outputText value="{0, number, ###,###}">
<apex:param value="{!o.Quantity}" />
</apex:outputText><br/></td>
<td style="font-size: 12px;" align="left" >{!o.UOM__c} </td>
<td style="font-size: 12px;" align="left" >{!o.CAS_No__c} </td>
<td style="font-size: 12px;" align="left">{!o.HSN_Code__c} </td>
<td style="font-size: 12px;" align="left">{!o.UnitPrice} </td>
<td style="font-size: 12px;" align="left">{!o.Total_Price_Incl_GST__c} </td>
<td style="font-size: 12px;" align="left">{!o.Product2.Description} </td>
</tr>
</apex:repeat>
<tr>
<td style="font-size: 14px;" colspan="7" align="Right">
<b>Grand Total</b>
</td>
<td style="font-size: 12px;" align="left">{!ord.TotalAmount}
</td>
<td style="font-size: 12px;" align="left">
</td><td style="font-size: 12px;" align="left">
</td>
</tr>
</table>
<table style="width:100%" border="0" cellspacing="0" >
</table>
</apex:page>
Any idea how to avoid this? Even that field was in query.
Thanks,
Kezia
This type of error usually occur when we use any field which is not fetch by us from org. In your case you have to
fetch ordernumber field data from order object in your ord list in apex class.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi