• Gouse Mohiddin 4
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Controller:
public class BankAccuont_TransactionStatus {
    public static void TransactionStatus(){
            List<Bank_Account__c> BankList = new List<Bank_Account__c>();
            List<Bank_Account__c> BList=[select id,Name,Account_Type__c,Number_Of_Transaction__c,Status__c from Bank_Account__c];
        for(Bank_Account__c b:BList){
            Bank_Account__c baccnt = new Bank_Account__c();
            if(b.Account_Type__c =='Current' && b.Number_Of_Transaction__c <=5){
                    baccnt.Status__c = 'Red';                  
                }
                else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c == 6 || b.Number_Of_Transaction__c ==10){
                    baccnt.Status__c = 'Yellow';                    
                } 
            else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c >= 10){
                    baccnt.Status__c = 'Green';
            }
            BankList.add(baccnt);            
        }
      // update BankList;
                
    }
}
=====================================================
trigger:
trigger Update_Status_Based_On_Transactions on Bank_Account__c (after insert,after update) {
    
    BankAccuont_TransactionStatus.TransactionStatus(trigger.new);
}
Send total balance of Bank Account to account holder (which is a contact) on first day of every month.
Below Code Is Working For Insert Operation, Now I Need Max Number In the Case of Delete Operation How Can Get?


trigger SkillGroup_With_High_Rank on Skill_Group__c (after insert,before delete) {
        List<Id> AccnId = New List<Id>();
    public String Maxno;
   
    for(Skill_Group__c sk:Trigger.New){
        
        AccnId.add(sk.Account_Name__c); 
        system.debug('Accountssss'+AccnId);
    }
    list<aggregateResult> aggResults = [Select Max(Rank__c)RA from Skill_Group__c Where Account_Name__c In:AccnId ];
    
      system.debug('@@@@@@'+aggResults[0].get('RA'));
   Maxno = string.valueOf(aggResults[0].get('RA'));
    system.debug('$$$$$$$'+Maxno);
    for(Account ac: [Select id,Skill__c from Account where id In:AccnId]){
        ac.Skill__c = Maxno; 
    }
    }
Controller:
public class BankAccuont_TransactionStatus {
    public static void TransactionStatus(){
            List<Bank_Account__c> BankList = new List<Bank_Account__c>();
            List<Bank_Account__c> BList=[select id,Name,Account_Type__c,Number_Of_Transaction__c,Status__c from Bank_Account__c];
        for(Bank_Account__c b:BList){
            Bank_Account__c baccnt = new Bank_Account__c();
            if(b.Account_Type__c =='Current' && b.Number_Of_Transaction__c <=5){
                    baccnt.Status__c = 'Red';                  
                }
                else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c == 6 || b.Number_Of_Transaction__c ==10){
                    baccnt.Status__c = 'Yellow';                    
                } 
            else if(b.Account_Type__c=='Current' && b.Number_Of_Transaction__c >= 10){
                    baccnt.Status__c = 'Green';
            }
            BankList.add(baccnt);            
        }
      // update BankList;
                
    }
}
=====================================================
trigger:
trigger Update_Status_Based_On_Transactions on Bank_Account__c (after insert,after update) {
    
    BankAccuont_TransactionStatus.TransactionStatus(trigger.new);
}
I have a process builder that is creating detail records and populating a few fields on creation. I also have an after insert trigger that is firing based on one of the fields that is populated during the record creation in the process builder.  Both function perfectly independently but when a record is created through the process builder that should fire the trigger it does not.  Any ideas or resources would be greatly appreciated since I'm new to triggers?