You need to sign in to do that
Don't have an account?
Gouse Mohiddin 4
help me out here
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);
}
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);
}
You forgot to give the account list parameter on the transactionStatus method. Try the below code. If it helps you mark this answer as best.
Happy Coding!!
All Answers
Could you explain the logic which you want to implement?
You forgot to give the account list parameter on the transactionStatus method. Try the below code. If it helps you mark this answer as best.
Happy Coding!!