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

Custom Button Not Working



I have an extremely simple Salesforce app I've created for a non-profit.  For one of my custom objects, called Donation, I created a custom button called 'Receipt' that runs Visual Force code to create a PDF that renders in a separate window.   This VF code runs perfectly fine in my development account (a DE).  However, when I create a package of my app and install it on another DE, that the non-profit will be using, this VF code for this button does not work.  Instead, I get the following error message:


Visualforce Error

common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL without querying the requested field: srdforce__Donation__c.srdforce__Check_No__c


Here is the VF code for button 'Receipt':


<apex:page standardController="srdforce__Donation__c" showHeader="FALSE" standardStylesheets="false" renderas="pdf">

{! IF(ISBLANK(Donation__c.Check_No__c), "PLEASE ENTER Check Number BEFORE PRINTING RECEIPT", "")}

<hr style="color: 'black'; height: '1'; text-align: 'center'; width: '50%'"/>
Indo-American Cultural &amp; Religious Foundation<br/>
P.O. Box 35275 &nbsp;&nbsp;&nbsp; Phoenix AZ 85069<br/>
Tax ID: 86-0620445 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A non-profit organization - IRS Section 501(c)(3)<br/><br/>
<strong style="font-size:20px">IACRF Donation Receipt</strong>
<hr style="color: 'black'; height: '1'; text-align: 'center'; width: '50%'"/>

<strong>Receipt No:</strong> {!Donation__c.Receipt_Number__c} &nbsp;&nbsp;&nbsp;&nbsp;
<strong>Donation Amount:</strong>&nbsp;&nbsp;<apex:outputField value="{!srdforce__Donation__c.srdforce__Donation_Amount__c}"/> &nbsp;&nbsp;&nbsp;&nbsp;
<strong>Check No:</strong>&nbsp;&nbsp;{!Donation__c.Check_No__c}&nbsp;&nbsp;&nbsp;&nbsp;
<strong>Date:</strong>&nbsp;&nbsp;<apex:outputText value="{!MONTH(TODAY())}"/>/<apex:outputText value="{!DAY(TODAY())}"/>/<apex:outputText value="{!YEAR(TODAY())}"/>


<!-- Show Mailing Address -->
{!Donation__c.Donor__r.First_Name__c} {!Donation__c.Donor__r.Last_Name__c}<br/>


{!Donation__c.Donor__r.City__c}, {!Donation__c.Donor__r.State__c}  {!Donation__c.Donor__r.Postal_Code__c}<br/>

Received above donation on &nbsp;&nbsp; <strong><apex:outputField value="{!srdforce__Donation__c.srdforce__Date__c}"/></strong><br/><br/>

The Foundation and Bharatiya EKTA Mandir appreciate your loyalty and support, and gratefully acknowledge your generous donation.<br/><br/><br/>
Thank you,


Lalit Patel <br/>
Treasurer <br/>
IACRF/Bharatiya EKTA Mandir


No goods or services were provided as a part your donation.<br/>
NOTE: Your contribution is tax deductible to the extent permitted by the IRS.<br/>
Please consult your tax advisor.



Any help or suggestion for debugging this is welcome!





This  means that  the field srdforce__Check_No__c is missing.

Check is the field srdforce__Donation__c exists in the custom object in the destination org.


srdforce__Donation__c does exist in my destination org, as does srdforce__Check_No__c.

As for controllers (you asked this in the email that got sent to me) I am using the standard controller for srdforce__Donation__c. If this is an incorrect implementation, please let me know. Otherwise, how would I update the controller for this custom object?


Can you plz try creating an extension for this controller ,from that controller query the srdforce__Donation__c object(along with the related fields) and using setter/getter try to display/update the value.

In the line <strong>Check No:</strong>&nbsp;&nbsp;{!Donation__c.Check_No__c}​&nbsp;&nbsp;&nbsp;&nbsp;

Try replacing {!Donation__c.Check_No__c} in with srdforce__Donation__c.srdforce__Check_No__c




I tried your suggestion and that did not work.  I got the following error after making this change and clicking 'Save':


Error: Unknown property 'srdforce__Donation__cStandardController.Donation__c'