Skip to main content
code formatting
Source Link
martin
  • 12.7k
  • 10
  • 50
  • 75

//Error: Line 10: Date arithmetic expressions must use Integer or Long arguments

trigger Trigger1_3 on Account (before insert,before update) {

trigger Trigger1_3 on Account (before insert,before update) {

    if(Trigger.isInsert)
    {
        for(Account acc: Trigger.New)
        {
            if(!isEmpty(acc.Start_Date__c))
            {
           
              if((System.today()- acc.Start_Date__c) < 0)
             {
                 acc.Status__c='In Progress - Violated';
             }
                else
                {
                    acc.Status__c='In Progress';
                }
           }
            else
            {
                 acc.Status__c='Not Started';
            }
       }     
    }
        
}

}

//Error: Line 10: Date arithmetic expressions must use Integer or Long arguments

trigger Trigger1_3 on Account (before insert,before update) {

if(Trigger.isInsert)
{
    for(Account acc: Trigger.New)
    {
        if(!isEmpty(acc.Start_Date__c))
        {
       
          if((System.today()- acc.Start_Date__c) < 0)
         {
             acc.Status__c='In Progress - Violated';
         }
            else
            {
                acc.Status__c='In Progress';
            }
       }
        else
        {
             acc.Status__c='Not Started';
        }
   }     
}
    

}

//Error: Line 10: Date arithmetic expressions must use Integer or Long arguments

trigger Trigger1_3 on Account (before insert,before update) {

    if(Trigger.isInsert)
    {
        for(Account acc: Trigger.New)
        {
            if(!isEmpty(acc.Start_Date__c))
            {
           
              if((System.today()- acc.Start_Date__c) < 0)
             {
                 acc.Status__c='In Progress - Violated';
             }
                else
                {
                    acc.Status__c='In Progress';
                }
           }
            else
            {
                 acc.Status__c='Not Started';
            }
       }     
    }
        
}
Source Link

How to use arithmetic operations with Date type in trigger?

//Error: Line 10: Date arithmetic expressions must use Integer or Long arguments

trigger Trigger1_3 on Account (before insert,before update) {

if(Trigger.isInsert)
{
    for(Account acc: Trigger.New)
    {
        if(!isEmpty(acc.Start_Date__c))
        {
       
          if((System.today()- acc.Start_Date__c) < 0)
         {
             acc.Status__c='In Progress - Violated';
         }
            else
            {
                acc.Status__c='In Progress';
            }
       }
        else
        {
             acc.Status__c='Not Started';
        }
   }     
}
    

}