• Eliezer Augusto Javier Bautista 7
  • NEWBIE
  • 20 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
I get this error in every test class :

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Required Field: []

The error comes at every  "Insert " function 



 
This if a part of the code where if categories are 'ST' there's a calculation, and if they are  'NS'  there's another. I need to make it the following "If the categories = ST or MSF to have the same calculations.

              IF(productobj.Categories__c=='ST')
                {
                    strunitprice=productobj.Manual_Cost__c.setScale(2);
                    system.debug('strunitprice'+strunitprice);
                }
                ELSE
                {
                    strunitprice=pricebkenryobj.UnitPrice.setScale(2);
                }    
                 
                //Add Percent start
                if(productobj.Categories__c=='NS')
                {
                   //Product info
                saveERPDataDetail .put('prdname',string.valueOf(productobj.name));
                saveERPDataDetail .put('prdunitcost',string.valueOf(untprice));
                saveERPDataDetail .put('prdcat',string.valueOf(productobj.Categories__c));
This if a part of the code where if categories are 'ST' there's a calculation, and if they are  'NS'  there's another. I need to make it the following "If the categories = ST or MSF to have the same calculations.

              IF(productobj.Categories__c=='ST')
                {
                    strunitprice=productobj.Manual_Cost__c.setScale(2);
                    system.debug('strunitprice'+strunitprice);
                }
                ELSE
                {
                    strunitprice=pricebkenryobj.UnitPrice.setScale(2);
                }    
                 
                //Add Percent start
                if(productobj.Categories__c=='NS')
                {
                   //Product info
                saveERPDataDetail .put('prdname',string.valueOf(productobj.name));
                saveERPDataDetail .put('prdunitcost',string.valueOf(untprice));
                saveERPDataDetail .put('prdcat',string.valueOf(productobj.Categories__c));