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
Zoom_VZoom_V 

Trying to use a Today() on a Date field

I have the following class which I am using with an Email Service. I decided to put Today() into one of the fields in the object which would be receiving the InboundEmail, but I am getting a "Compile Error : Method does not exist or incorrect signature : Today()"

Here is the code : 
 
global class VendorEmail implements 
        Messaging.InboundEmailHandler {


Vendor_Notes__c[] NewVendorNotes = new Vendor_Notes__c[0];

 global Messaging.InboundEmailResult handleInboundEmail(
  Messaging.InboundEmail email, 
  Messaging.InboundEnvelope envelope) {
Messaging.InboundEmailResult result = 
        new Messaging.InboundEmailresult();
 
  // Captures email info
    
String emailAddress = envelope.fromAddress;
String fName = email.fromname.substring(
        0,email.fromname.indexOf(' '));
String lName = email.fromname.substring(
        email.fromname.indexOf(' '));
String[] emailBody = email.plainTextBody.split('\n', 0);
String phoneNumber = emailBody[0].substring(6);
       
//Associates email to proper Vendor Profile
//var today = new Date(0);  
Vendor_Profile__c venpro;
venpro = [select ID,ACH_Status__c from Vendor_Profile__c where name =
             :email.subject limit 1];
    ID jobId = venpro.ID;
    venpro.Date_of_Latest_Compliance_Certificate__c = Today();
    Update venpro;

try
    {
      NewVendorNotes.add(new Vendor_Notes__c(Sender__c = emailAddress,
      Vendor__c = jobId,
      Routing_Number__c = lName,
     Account_Number__c = phoneNumber
      ));
 
      insert NewVendorNotes;
      
      //Save any Binary Attachment
            
            if (email.binaryAttachments != null)
                {
                    for(Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments) 
                    {
                        Attachment attachment = new Attachment();
        
                        attachment.Name = bAttachment.fileName;
                        attachment.Body = bAttachment.body;
                        attachment.ParentId = venpro.Id;
                        insert attachment;
                    }
               } 
   }
    
   catch (System.DmlException e)   
   {
           

            //Save any Binary Attachment
            
            if (email.binaryAttachments != null)
                {
                    for(Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments) 
                    {
                        Attachment attachment = new Attachment();
        
                        attachment.Name = bAttachment.fileName;
                        attachment.Body = bAttachment.body;
                        attachment.ParentId = venpro.Id;
                        insert attachment;
                    }
               } 
}
return result;
       
    }
}

Anybody have any ideas ....?

Thank you very much for any help.
Andy BoettcherAndy Boettcher
Use "System.Today()".
Zoom_VZoom_V
Thanks Andy !