Customize a Salesforce Object: Create Formula Fields

Study for the Administrator Certification Exam > Object Manager and Lightning App Builder (15%) > Customize a Salesforce Object > Create Formula Fields

요구사항

  • collecting additional information on opportunities
  • sales and executive users to see their commission calculated for won opportunities
  • regions and zones of accounts displayed on opportunities for all to see
  • in an effort to enhance pipeline accuracy
    • display the discounted amount whenever a discount has been applied to an opportunity

Handle these requests by creating custom formula fields, which allow you to define calculations that reference other fields to display new numeric, text, date, or checkbox values specific to business requirements. Time to get started.

Calculate the Commission

Opportunity에 Closed Won이 된 레코드에 10 percent commission을 보여주세요.

  1. Setup > Object Manager > Opportunity > Fields & Relationships > New
    • Data Type: Formula
  2. Next
    • Field Label: Commission
    • Formula Return Type:
      • Currency
  3. Next
    • Select Field Type: Opportunity
    • Insert Feild: Amount
    • Insert Operator: *Multiply
    • Commission (Currency) =:
      • Amount * 0.1
    • Description: Calculates sales rep commission of 10 percent when opportunity is won.
    • Help Text: Sales rep commission when opportunity is won.
  4. Next
    • Visible > Check > Uncheck (=clear the checkboxes)
    • Sales User: Check ✅ Visible
    • System Administrator: Check ✅ Visible
  5. Next
  6. Save

방금 만든 Commission필드는 Opportunity의 Stage가 Closed Won일때만 보여주세요.

  1. Setup > Object Manager > Opportunity > Fields & Relationships > Commission > Edit > Advanced Formula
    • Commission (Currency) =
      • IF( ISPICKVAL( StageName , “Closed Won”) , Amount * 0.1, 0)
    • Check Syntax!
  2. Save!

Customize Formula Fields

Account의 Region / Zone을 Opportunity에서 보여주기 위해 Formula Field를 사용합니다.

  1. Setup > Object Manager > Opportunity > Fields & Relationships > New
    • Data Type: Formula
  2. Next
    • Field Label: Region/Zone
    • Field Name: Region_Zone
    • Formula Return Type: Text
  3. Next
    • Advanced Formula > Region/Zone (Text) =
      • Functions: TEXT > Insert Selected Function!
        TEXT( value )
      • select “value” > Insert Field! > Opportunity > Account > Region > Insert!
        TEXT( Account.Region__c )
      • Insert Operator > & Concatenate
        TEXT( Account.Region__c ) &
      • enter "/"
        TEXT( Account.Region__c ) & “/”
      • Insert Operator > & Concatenate
        TEXT( Account.Region__c ) & “/” &
      • Functions: TEXT > Insert Selected Function!
        TEXT( Account.Region__c ) & “/” & TEXT(value)
      • select “value”> Insert Field! > Opportunity > Account > Zone > Insert!
        TEXT( Account.Region__c ) & “/” & TEXT( Account.Zone__c )
    • Check Syntax
    • Description: Displays the Region and Zone values from the account record.
    • Help Text: Account region and zone.
  4. Next, Next, Save

Add New Field, Discount Percentage

  1. Setup > Object Manager > Opportunity > Fields & Relationships > New
    • Data Type: Percent
  2. Next
    • Field Label: Discount Percentage
    • Length: 3
  3. Next
    • Visible > Check > Uncheck (=clear the checkboxes)
    • Sales User: Check ✅ Visible
    • System Administrator: Check ✅ Visible
  4. Next, Save

Now create the formula.

  1. Setup > Object Manager > Opportunity > Fields & Relationships > New
    • Data Type: Formula
  2. Next
    • Field Label: Amount After Discount
    • Formula Return Type: ✅ Currency
  3. Next
    • Simple Formula!
    • Amount After Discount (Currency) =
      • Select Field Type: Opportunity
      • Insert Field: Amount
        Amount
      • Insert Operator: * Multiply
        Amount *
      • Insert Operator: ( Open Parenthesis
        Amount * (
      • Enter 1
        Amount * ( 1
      • Insert Operator: – Subtract
        Amount * ( 1 –
      • Insert Field: Discount Percentage
        Amount * ( 1 – Discount_Percentage__c
      • Insert Operator: ) Close Parenthesis
        Amount * ( 1 – Discount_Percentage__c )
    • Check Syntax!
    • Description: Calculates the opportunity amount after any discount has been applied.
    • Help Text: Opportunity amount after discount has been applied.
  4. Next, Next, Save