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,
                   Master_Agreement_Number__c,Current_Contract_Status__c,Date_Assigned_to_Specialist__c,
                   Date_Contract_Requested__c from Opportunity where id=: stdController.getId()];
        system.debug('--------------opp.id----------------'+opp.id );
    }
 
   
   //this is page load 
   public PageReference pageLoad(){
    
         PageReference oppPage = new ApexPages.StandardController(opp).view();
           oppPage.setRedirect(true);
            
      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');
           ApexPages.addMessage(errorMsg);
           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.');
                 ApexPages.addMessage(errorMsg);
                 return null ;
          }
         else
          {
              // 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 ];
              if(AgreementRequests_to_update.size()>0)
              {
                  for (Agreement_Request__c ar:AgreementRequests_to_update)
                  {
                      ar.Request_Status__c='Update from Opportunity';
                      ar.Updated_Agreement_Summary__c=opp.Updated_Agreement_Summary__c;
                  }
                 update AgreementRequests_to_update;
              }
                
              
           return oppPage;
         }
   }
   
}

 
Gil GourévitchGil Gourévitch
Hello,
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
Gil

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.