How to do it...

Carry out the following steps to create a validation rule to ensure that the reason why an opportunity has been lost is captured whenever an opportunity is recorded as lost:

  1. Click on the Setup gear icon in the top right-hand corner of the main Home page, as shown in the following screenshot:
  1. Click on Setup, as shown in the following screenshot:
  1. Navigate to the Opportunity Validations Rule setup page by clicking the following: Objects and Fields | Object Manager | Opportunity | Validation Rules.

Locate the Validation Rules section on the right of the page.

  1. Click on New.

You will be presented with the Opportunity Validation Rules edit page.

  1. Type Opportunity Reason Lost in the Field Label textbox.
  2. Upon clicking out of the text box, the name of the field label changes to Opportunity_Reason_Lost.
  3. Leave the Active checkbox set.
  4. Optionally, enter details in the Description field.
  5. Navigate to the Error Condition Formula section.
  6. Paste in, or enter, the following code:
AND( 

NOT(IsWon), 

IsClosed, 

ISBLANK(TEXT(Reason_Lost__c)) 

) 
  1. In the Error Message section, enter the text: Please select an option for the Opportunity Reason Lost field.
  2. For the Error Location option, select Field.

You will be presented with the Field selection pick list.

  1. Select the field Reason Lost.

 

  1. Finally, click on Save, as shown in the following screenshot:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset