You need to sign in to do that
Don't have an account?

Date Trigger
Some of the fields of the Object are CommencementDate, Expiry Date and Termination Date
I want to write a trigger
1)If the commencement date has not happened yet – it should trigger to pending
Can I try After Insert After Update Trigger
for(Office off: Trigger.new)
{
system.debug('Trigger.New size' +Trigger.New.size());
try
{
if(off.CommencementDate__c == ' ??')
off.Description = 'It is pending';
else if(off.CommencementDate__c==' ??')
off.Description = ' Active ';
}
catch (Exception e)
{
system.debug('Error');
}
}
How to write date trigger ?
An additional DML operation isn't needed in this case, so you can have your trigger run before insert and update. Your code would look something like the following:
I should also point out this could very easily be accomplished with Workflow Rules as well.
All Answers
An additional DML operation isn't needed in this case, so you can have your trigger run before insert and update. Your code would look something like the following:
I should also point out this could very easily be accomplished with Workflow Rules as well.
Thanks Buddy ! ,
Even I thought of writing workflows but I was told to write Trigger .