• Anand Nemmara
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi All,

Is anyone else facing this issue where in an excel file does not get uploaded for a long long time when you click on it.View that can be seen on clicking the excel file

This behaviour is just with the excel files but rest images and pdfs and getting loaded quickly for the preview. The size of the excel is just 80kb.

How can i handle this issue?

Any help would be appreciated!

Regards,
Anand
Hello All,

I am very new to writing test classes for triggers and it would be great if someone can help me write a test class for the below trigger. I have already tried writing the test class but not able to pass it in sandbox.

trigger CheckBeforeUpdate on Requests__c (before update) {
    
    for(Requests__c cr : Trigger.New)
    {
        String oldStatus=Trigger.oldMap.get(cr.Id).Status__c;
        if((cr.Status__c=='Approved' || cr.Status__c=='Pending Approval - Sales Mgr')  && oldStatus!='%Pending%')
        {

            if(cr.Invoice_Number__c==null || cr.Invoice_Date__c==null || cr.Expected_Payment_Date__c==null) 
            {
                cr.addError('You must fill the invoice number and invoice date in order to approve the request');
            }
        }
              
    }
      
}

Test class:

@isTest
public class CheckBeforeUpdate_TestClass{
    static testMethod void  CheckBeforeUpdateTest()
    {
        requests__c obj = new requests__c();
        obj.Account__c='001f400000B4c9NAAR';
        obj.Description__c='Testing';
        obj.Period_From__c=Date.newInstance(2016, 12, 9);
        obj.Period_To__c=Date.newInstance(2018, 12, 9);
        obj.Status__c='Pending';
        
        Test.startTest();
        try{
    
 
        obj.Status__c='Approved';
         update obj;
      
      

   } catch(DmlException error) {

     System.assertEquals(StatusCode.FIELD_CUSTOM_VALIDATION_EXCEPTION, error.getDmlType(0));
      System.assertEquals('You must fill the invoice number and invoice date in order to approve the request', error.getDmlMessage(0));
                               } 
        Test.stopTest();
    }
}

Can someone please let me know what is that I am missing. Getting thsi error "System.AssertException: Assertion Failed: Expected: FIELD_CUSTOM_VALIDATION_EXCEPTION, Actual: MISSING_ARGUMENT" and 0% code coverage

Any help would be appreciated.

Regards,
Anand