→ Apex Trigger 5
Prerequisite
Requirement
Develop an Apex Trigger on Opportunity so that when any opportunity is created and if the Discount & Amount field is not blank then calculate the discount and store it in the Discount Price field.
To Calculate the discount use the below formula and store it in a variable
Decimal discount = ( Discount * Amount ) / 100
To Calculate the Discounted Price use the below calculation and store it in a variable
Decimal discountedAmount = Amount – discount;