function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nishant Kumar 274Nishant Kumar 274 

Create custom field Discount Percent on Discount object and use in the below code

Create custom field Discount Percent on Discount object and use in the below code:-
public class DiscountTriggerHelper {
    
    public static void beforeTrigApplyDiscount(List<Discount__c> discounts){
        
        for(Discount__c disc : discounts){
            If(disc.Discount_Applied__c == false && disc.Amount__c >= 100){
                disc.Amount__c = disc.Amount__c + 10;
                disc.Discount_Applied__c = true;
            }
        }
    }
}
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Nishanth,

Please use the below test class to cover both triger and class as 100%.
 
@isTest
public class TestAccount {
static testMethod void myUnitTest()  {
        
         Discount__c dis = new Discount__c ();
        dis.Discount_Applied__c = false;
        dis.Amount__c  = 200;
        insert dis;
        
    }
}

if this solution helps, Please mark it as best answer.

Thanks,