👷🔧 Storyforce is under early construction, many pages are half finished! 🔧👷
Playbook
Objects and Fields
Object Manager
Opp Validation Rules

Opportunity Validation Rules

Opportunity Close Date In The Past

Design

User Story
As a Salesforce User
I want the system to prevent the Close Date from being in the past when an opportunity is changed to Closed Won or Closed Lost
So that I can ensure the data is accurate and up-to-date
Acceptance Criteria
Given I am on an Opportunity record page
When I change the opportunity stage to Closed Won or Closed Lost
Then an error message is displayed if the Close Date is in the past

Build

Rule Name: Close_Date_In_The_Past
Description: Prevent the Close Date from being in the past when the opportunity stage is Closed Won or Closed Lost
Error Condition Formula:

Rule Name: Close_Date_In_The_Past
Description: Prevent the Close Date from being in the past when the opportunity stage is Closed Won or Closed Lost
Error Condition Formula:

AND(
   ISCHANGED(StageName),
   CloseDate < TODAY(),
   OR(
       ISPICKVAL(StageName, "Closed Won"),
       ISPICKVAL(StageName, "Closed Lost")
   )
)

Error Message: Close Date cannot be in the past when closing an opportunity
Error Location: Close Date

Test

Steps

  1. Open an Opportunity record page
  2. Set the Close Date to a past date
  3. Change the stage to Closed Won or Closed Lost
  4. Click Save

Expected Results

  1. An error message is displayed
  2. The error message should read 'Close Date cannot be in the past when closing an opportunity'

Opportunity Stage Mandatory Fields

Design

User Story
As a Salesforce User
I want the system to enforce mandaotry fields at pre-defined opportunity stages
So that I can ensure the data is accurate and complete
Acceptance Criteria
Given I am on an Opportunity record page
When the stage is changed to pre-defined opportunity stages
Then the relevant fields are mandatory and an error message is displayed if the fields are empty

Build

Rule Name: {stage-name}_Stage_Mandatory_Fields
Description: Enforce mandatory fields when the stage is'{stage-name}'
Error Condition Formula:

AND(
   ISCHANGED(StageName),
   ISPICKVAL(StageName, "Example_Stage_Name"),
   OR(
       ISPICKVAL( Example_Picklist_Field, ""),
       ISBLANK( Example_Text_Field )
   )
)

Error Message: {Example_Picklist_Label} and {Example_Text_Label} are mandatory when the stage is '{stage-name}'
Error Location: Top of the page | Field

Test

Steps

  1. Open an Opportunity record page
  2. Change the stage to '{stage-name}'
  3. Leave the {Example_Picklist_Label} and {Example_Text_Label} fields empty
  4. Click Save

Expected Results

  1. An error message is displayed
  2. The error message should read '{Example_Picklist_Label} and {Example_Text_Label} are mandatory when the stage is '{stage-name}'

Specific Record Type Opportunity Stage Mandatory Fields

Design

User Story
As a Salesforce User
I want the system to enforce mandaotry fields at pre-defined {record-type} opportunity stages
So that I can ensure the data is accurate and complete
Acceptance Criteria
Given I am on an {record-type} Opportunity record page
When the stage is changed to pre-defined Opportunity stages
Then the relevant fields are mandatory and an error message is displayed if the fields are empty

Build

Rule Name: {record-type}_{stage-name}_Stage_Mandatory_Fields
Description: Enforce mandatory fields when the record type is {record-type} and the stage is' {stage-name}'
Error Condition Formula:

AND(
   RecordType.DeveloperName == "Example_Record_Type_Name",
   ISCHANGED(StageName),
   ISPICKVAL(StageName, "Example_Stage_Name"),
   OR(
       ISPICKVAL(Example_Picklist_Field, ""),
       ISBLANK(Example_Text_Field)
   )
)

Error Message: {Example_Picklist_Label} and {Example_Text_Label} are mandatory when the stage is '{stage-name}' on '{record-type}' opportunities
Error Location: Top of the page | Field

Test

Steps

  1. Open an Opportunity record page with the record type '{record-type}'
  2. Change the stage to '{stage-name}'
  3. Leave the {Example_Picklist_Label} and {Example_Text_Label} fields empty
  4. Click Save

Expected Results

  1. An error message is displayed
  2. The error message should read '{Example_Picklist_Label} and {Example_Text_Label} are mandatory when the stage is '{stage-name}' on '{record-type}' opportunities