• DasG
  • NEWBIE
  • 0 Points
  • Member since 2012

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

ex: am trying like this but it won't  workout. then how????
trigger acctrig on Account (before insert,after update) {
Account acc =new Account();
          if(acc.SLAExpirationDate__c != System.today())
             acc.addError('Error! enter only today date');
}
or
trigger acctrig on Account (before insert,after update) {
Account acc =new Account();
acc.today__c = date.today();
if(acc.SLAExpirationDate__c !=acc.today__c)
acc.addError('Error! enter only today date');
}

so pls share anather better sample code for this.

  • August 13, 2012
  • Like
  • 0

ex: am trying like this but it won't  workout. then how????
trigger acctrig on Account (before insert,after update) {
Account acc =new Account();
          if(acc.SLAExpirationDate__c != System.today())
             acc.addError('Error! enter only today date');
}
or
trigger acctrig on Account (before insert,after update) {
Account acc =new Account();
acc.today__c = date.today();
if(acc.SLAExpirationDate__c !=acc.today__c)
acc.addError('Error! enter only today date');
}

so pls share anather better sample code for this.

  • August 13, 2012
  • Like
  • 0

Take a number field on Account. Whnever a Contact is inserted for a particular account, number value in accoutn ahould be increamented by 1.