siddharth10p / GenWattCore

0 stars 0 forks source link

Create formulas for discounts #2

Open siddharth10p opened 2 months ago

siddharth10p commented 2 months ago

Case Study (Scenario):

Genwatt would like to provide two types of discount to their existing or new customer.

  1. Permanent Discount: Under this scheme, the discount would be given to the customer every time when product is Purchased. Depending upon the relationship with the customer this discount can be up to 25%

  2. One time Discount (for particular products / deals / Opportunities): This discount is only provided per Opportunity. This helps Genwatt to improve the relationship with new customer and to gain more business / revenue eventually. This discount can be up to 25% depends upon the different product / customer category.

Note: This is one time discount, if customer will purchase anything in future this discount wouldn’t applied.

A customer can be qualified for one or both types of discount. Genwatt would like you to build a custom solution to calculate the one or both discount values and subtract it from the Opportunity amount.

Case Study (Analysis):

Genwatt has decided to implement formula fields for the following reasons:

  1. Formula fields are easy to create and deploy using the browser without any external (tools) interfaces
  2. The cross-object formula field can include the field of the other object in the calculation
  3. Formulas refresh at the run time

Note: Please think for a while and then find the below solution to know step by step implementation.

siddharth10p commented 2 months ago

Case Study (Solution):

1. Create two fields to track the both Discount (%)
        a. Create a custom field on Account
            Type: Percent
            Label: Negotiated Discount Rate
            Length: 2
            Decimal Places: 2
            Leave default setting on the next steps and click on the Save

        b. Create a custom field on Opportunity
            Type: Percent
            Label: Discount Rate
            Length: 2
            Decimal Places: 2
            Leave default setting on the next steps and click on the Save

2. Create following formulas to auto-calculate discount and display final amount
        a. Create a formula to calculate amount based off Negotiated Discount Rate
            Type: Formula
            Label: Negotiated Discount Amount
            Return Type: Currency
            Decimal Places: 2
            Formula: Account.Negotiated_Discount_Rate__c * Amount
            Click on Check Syntax
            Leave default setting on the next steps and click on the Save

        b. Create a formula to calculate discount amount based off Discount Rate
            Type: Formula
            Label: Discount Amount
            Return Type: Currency
            Decimal Places: 2
            Formula: Discount_Rate__c  * Amount
            Click on Check Syntax
            Leave default setting on the next steps and click on the Save

        c. Create a formula to sum both the discount amounts
            Type: Formula
            Label: Total Discount Amount
            Return Type: Currency
            Decimal Places: 2
            Formula: Discount_Amount__c + Negotiated_Discount_Amount__c
            Click on Check Syntax
            Leave default setting on the next steps and click on the Save

        d. Create a formula to subtract discount amount and display final payable amount
            Type: Formula
            Label: Amount After Discount
            Return Type: Currency
            Decimal Places: 2
            Formula: Amount - Total_Discount_Amount__c
            Click on Check Syntax
            Leave default setting on the next steps and click on the Save
siddharth10p commented 2 months ago

Additional Assignment:

  1. Calculate the contact’s age based off the Birthdate field Object: Contact Formula Field Name: Age Hint: Use Birthdate standard field and TODAY from the functions

  2. The company would like to see Opportunity Stage on Opportunity Product related list (See below screenshot) Object: Opportunity Product Field Name: Current Stage Hint: Pull the stage information on OpportunityProduct object and then modify the related list on Opportunity page to add the field. Click here to know more about how to edit page layout

The below screenshot is taken from classic view, don't worry if you are using lightning and your page doesn't look like below!

Image