👷🔧 Storyforce is under early construction, many pages are half finished! 🔧👷
Playbook
Lost Opportunity

Lost Opportunity Quick Action

To do

  1. Create global picklist
  2. Create custom opportunity fields
  3. Create validation rules
  4. Create a quick action to update the opportunity

Design

As a Salesforce User
I want to have an easy way to mark an Opportunity as lost
So that I can track the lost Opportunities and related information
Acceptance Criteria
Given I am on an Opportunity record page
When I click the Lost button
Then the Opportunity status is updated to Lost and I can see the Lost Reason fields

Build

Opportunity Lost Action Opportunity Loss Information

Task Name: Create Lost Opportunity Quick Action

Create Global Value Set

💡

Loss Reason field on the Opportunity object can be promotoed to a global value set to be used across the org

Label: Loss Reasons
Display values alphabetically, not in the order entered: False
Use first value as default value: False

Values:

  • Lost to Competitor
  • No Budget / Lost Funding
  • No Decision / Non-Responsive
  • Price
  • Other

Create Opportunity Fields

Label: Loss Reason
Type: Picklist
Values: Loss Reasons (Global Value Set)

Label: Loss Reason Comments
Type: Text Area (Short 255 Characters)
Help Text: Comments to explain loss reason. Mandatory if loss reason equals 'Other'

Label: Stage
API Name: Stage_Text
Type: Formula
Description: Text representation of the Stage field, to be used as a non editable field on the 'Lost' quick action
Formula Return Type: Text
Formula: TEXT(StageName)

Label: CLose Date
API Name: Close_Date_Text
Type: Formula
Description: Text representation of the Close Date field, to be used as a non editable field on the 'Lost' quick action
Formula Return Type: Date
Formula: TEXT(CloseDate)

Page layout:

  • Add a section called Loss Information to the page layout above the System Information section
  • Add the Loss Reason, Loss Reason Comments (2 columns)

Create Validation Rules:

Rule Name: Loss_Reason_Mandatory
Error Message: Loss Reason is mandatory if Stage equals 'Closed Lost'
Error Location: Field -> Loss Reason
Formula:

AND(
    ISCHANGED(StageName),
    ISPICKVAL(StageName, 'Closed Lost'),
    ISPICKVAL(Loss_Reason__c, '')
)

Rule Name: Loss_Comments_Mandatory
Error Message: Loss Comments are mandatory if loss reason equals 'Other'
Error Location: Field -> Loss Reason Comments
Formula:

AND(
    ISPICKVAL(StageName, 'Closed Lost'),
    ISPICKVAL(Loss_Reason__c , 'Other'),
    ISBLANK(Loss_Reason_Comments__c)
)

Create Action on Opportunity

Object Name: Opportunity
Action Type: Update a Record
Label: Lost
Name: Lost_Opportunity
Description: Mark the Opportunity as Lost and record the reason
Success Message: Opportunity Lost

Predefined Values:

  • Stage: Closed Lost
  • Close Date: TODAY()

Layout:

On the left:

  • Stage (Read Only Formual Field)
  • Loss Reason (required)

On the right:

  • Close Date
  • Loss Reason Comments

Add the Lost action to the Opportunity page layout

Test

Steps:

  1. Open an Opportunity record
  2. Click the Lost button
  3. Verify the Close Date is defaulted to todays date
  4. Verify the Loss Reason is mandatory
  5. Verify the Loss Reason Comments are mandatory if Loss Reason is 'Other' (try saving without comments when Loss Reason is 'Other' and verify the error message)
  6. Poulate the Loss Reason and Loss Reason Comments fields and
  7. Click 'Save'

Expected Results:

  1. Verify the Opportunity stage is updated to 'Closed Lost'
  2. Verify the Close Date is updated to today's date
  3. Scroll to the 'Loss Information' section and verify the loss reason, loss reason comments are set to the values entered