• Narasimha Lakshmi
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
I have a validation rule:  AND( 
OR(BillingCountry = "US", BillingCountry = "USA", 
BillingCountry = "Hindustan"), 
NOT(REGEX(BillingPostalCode, 
"\\d{5}(-\\d{4})?")) )

I am not able to save  record after gave valid postal code.
Ex format:99999 or 99999-9999

Please let me know where i have done mistake
 
This was my debug list of SOQL 
Number of SOQL queries: 38 out of 100
  Number of query rows: 73 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 184 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10


Stil I am getting Time out error.
(I had cleared all cache in vf page)
 
trigger ClosedOpportunityTrigger on Opportunity (before insert,before update) {
    List<task> tsklst=new List<task>();
   List<Opportunity> opplst=new List<Opportunity>([select id,StageName from opportunity where id in:Trigger.New]);
    //List<Opportunity> opplst=new List<Opportunity>();
    if(Trigger.isInsert || Trigger.isUpdate)
    {
       if(opplst.StageName =='Closed Won')
        {
            for(Opportunity opp:Trigger.new){
                
                system.debug('@@@@@@@' +opp);
         Task t=New Task();
             t.WhatId = opp.id;
            t.Subject = 'Follow Up Test Task';
            tsklst.add(t);
            } 
        }
        insert tsklst;
        
    }
}
I have a validation rule:  AND( 
OR(BillingCountry = "US", BillingCountry = "USA", 
BillingCountry = "Hindustan"), 
NOT(REGEX(BillingPostalCode, 
"\\d{5}(-\\d{4})?")) )

I am not able to save  record after gave valid postal code.
Ex format:99999 or 99999-9999

Please let me know where i have done mistake