• Deexith
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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 ?

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 ?