You need to sign in to do that
Don't have an account?
V Anand
How to compare datetime fields in trigger?
Field that records the Date/Time of the last received lead. Now I want to compare current date with previous date of same field.
Could you please any one write coding for above.......
Campare your dateTime field with "isSameDay".
datetime myDate = datetime.now();
datetime previousDate = datetime.newInstance(2008, 1, 30);
boolean dueNow = myDate.isSameDay(dueDate);
I missed to change variable name
datetime myDate = datetime.now();
datetime previousDate = datetime.newInstance(2008, 1, 30);
boolean dueNow = myDate.isSameDay(previousDate );
In after insert trigger you can get old values and new values array for the records which have fired the trigger. you can compare the old values and new values and do the needful.