• Mmehtab
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I have controller classes with Wrappers and am unable to the wrapper methods where the selected box=True. User-added imageUser-added image

I am new to apex and not sure how to access the wrapper in a way to be able to cover the lines of code in red. Any help is appreciated.
Thanks!
 
Total newbie to apex. I seem to able to test this trigger fine, but it still runs into governer limits while deploying. Please suggest what can be done to improve the code. 

trigger CheckDeptAllocations on Expense_Report__c (before update) {

    for( Expense_Transaction__c ExpTrans:[SELECT Id, Expense_Amount__c, Allocated_By_Department__c,Amount_Equals_Department_Allocations__c,Expense_Report__c FROM Expense_Transaction__c
                                          where Amount_Equals_Department_Allocations__c=False and Allocated_By_Department__c>0 and Expense_Report__c in: Trigger.new]){
                                          
    If( ExpTrans.Id !=NULL && ExpTrans.Expense_Report__c!= NULL){
    for (Expense_Report__c e: Trigger.New){
        // Check where report status is 'Extracted for Payment'
          if(e.Report_Status__c=='Extracted for Payment'&& ExpTrans.Allocated_by_Department__c>0 && ExpTrans.Amount_Equals_Department_Allocations__c==False) {
                                e.addError('Please make sure all Department Allocations equal the Expense Amount on transactions.');
                return;
           
    }
        
    }
}
}
}
I have controller classes with Wrappers and am unable to the wrapper methods where the selected box=True. User-added imageUser-added image

I am new to apex and not sure how to access the wrapper in a way to be able to cover the lines of code in red. Any help is appreciated.
Thanks!