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
Frank JordanFrank Jordan 

Invalid field Update_Contract_Request_Summary__c for SObject Opportunity

I have the following code and I am receiving this error: Invalid field Update_Contract_Request_Summary__c for SObject Opportunity. Does anyone know how to fix this? 
public class UpdateRequestContractExttwo_ecsg   {
    private final Opportunity opp;
    Opportunity tempOpp ;
    public UpdateRequestContractExttwo_ecsg(ApexPages.StandardController stdController) {
        this.opp = (Opportunity)stdController.getRecord();
        tempOpp = [select id ,ContactVerified__c,Contract_Specialist_Assigned__c, type,
                   Date_Contract_Requested__c from Opportunity where id=: stdController.getId()];
        system.debug('' );
   //this is page load 
   public PageReference pageLoad(){
         PageReference oppPage = new ApexPages.StandardController(opp).view();
      if(opp.Contract_Request_Date__c == null){ 
           ApexPages.Message errorMsg = new ApexPages.Message(ApexPages.Severity.Error,'A contract has not be requested for this Oppotunity yet');
           return null ;
      }else if(Opp.Update_Contract_Request_Summary__c == null || Opp.Update_Contract_Request_Summary__c =='')
                 ApexPages.Message errorMsg = new ApexPages.Message(ApexPages.Severity.Error,'Please enter Updated Contract Request Summary.');
                 return null ;
              // set All associated ARs to Update from Oportunity
              List<Agreement_Request__c> AgreementRequests_to_update=new List<Agreement_Request__c>();
              AgreementRequests_to_update=[Select id,Request_Status__c,Opportunity__c from Agreement_Request__c where Opportunity__c=:opp.Id ];
                  for (Agreement_Request__c ar:AgreementRequests_to_update)
                      ar.Request_Status__c='Update from Opportunity';
                 update AgreementRequests_to_update;
           return oppPage;

Gil GourévitchGil Gourévitch
First be sure that you create the field with the right API name Update_Contract_Request_Summary__c.
If this is ok, be sure that your profile can access the field (Setup / opportunity / fields / Update_Contract_Request_Summary__c / button field level security, then check if your profile can access this field).

Hope this helps

Question Solved ? Please mark as the best answer to help other users !

Frank JordanFrank Jordan
Hi Gil,

The API name is correct and my profile has access to this field. Any other suggestions? Thanks.