• Padtalluri
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I have written the below formula field to  add the number of working days to the created date for diffrent record types , but it is adding 3 business days to all scenarios.

IF(RecordType.DeveloperName ="Request_for_Data",CASE( 
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
3, CreatedDate + 2 + 3, 
4, CreatedDate + 2 + 3, 
5, CreatedDate + 2 + 3, 
6, CreatedDate + 1 + 3, 
CreatedDate + 3), 
IF(RecordType.DeveloperName ="Network_Information_Request", CASE( 
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
3, CreatedDate + 2 + 3, 
4, CreatedDate + 2 + 3, 
5, CreatedDate + 2 + 3, 
6, CreatedDate + 1 + 3, 
CreatedDate + 6), 
IF(RecordType.DeveloperName ="Network_Analysis_Request", CASE( 
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
3, CreatedDate + 2 + 3, 
4, CreatedDate + 2 + 3, 
5, CreatedDate + 2 + 3, 
6, CreatedDate + 1 + 3, 
CreatedDate + 8), 
IF(RecordType.DeveloperName ="Network_Analsysis_Adding_New_Employees_Divisions", CASE( 
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
3, CreatedDate + 2 + 3, 
4, CreatedDate + 2 + 3, 
5, CreatedDate + 2 + 3, 
6, CreatedDate + 1 + 3, 
CreatedDate + 8), 
IF(RecordType.DeveloperName = "Network_Options_Due_to_Provider_Termination", 
CASE( 
MOD(DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
3, CreatedDate + 2 + 3, 
4, CreatedDate + 2 + 3, 
5, CreatedDate + 2 + 3, 
6, CreatedDate + 1 + 3, 
CreatedDate + 8),null) 



System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactId]: [ContactId]
trigger AlertTrigger on Alert__c (after update) {

System.debug('@@@@@@@@@@@');

    List<Account> acctlist = new List<Account>();
    Set<Id> acid = new Set<Id>();
       
       for(Alert__c ab:Trigger.New) {
           
           acid.add(ab.Account__c);
           
           system.debug('&&&&&&&&'+acid); 
       }
       
       Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
           Set<Account> a = new Set<Account>();

    
          for(Alert__c b : Trigger.new){
     
              if(acct.containsKey(b.Account__c)) {
                   If(b.Type__c == 'New Client') 
        
                   {
                     
                      Account upd = acct.get(b.Account__c);
                        
                      If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker') 
                        { 

                          upd.Effective_Date__c = b.Effective_Date__c;
                          upd.Aetna_Region__c = b.Region__c;
                          a.add(upd);
            
                        }   
                  }

      }
   }
   
   
     acctlist.addAll(a);
    
     update acctlist;

}
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactId]: [ContactId]
trigger AlertTrigger on Alert__c (after update) {

System.debug('@@@@@@@@@@@');

    List<Account> acctlist = new List<Account>();
    Set<Id> acid = new Set<Id>();
       
       for(Alert__c ab:Trigger.New) {
           
           acid.add(ab.Account__c);
           
           system.debug('&&&&&&&&'+acid); 
       }
       
       Map<Id,Account> acct = new Map<Id,Account>([Select Id,Effective_Date__c,Region__c from Account where Id in :acid]);
           Set<Account> a = new Set<Account>();

    
          for(Alert__c b : Trigger.new){
     
              if(acct.containsKey(b.Account__c)) {
                   If(b.Type__c == 'New Client') 
        
                   {
                     
                      Account upd = acct.get(b.Account__c);
                        
                      If(upd.Relationship__c == 'Client' || upd.Relationship__c == 'Broker') 
                        { 

                          upd.Effective_Date__c = b.Effective_Date__c;
                          upd.Aetna_Region__c = b.Region__c;
                          a.add(upd);
            
                        }   
                  }

      }
   }
   
   
     acctlist.addAll(a);
    
     update acctlist;

}