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

Case Validation Rules

Enforce User Assignment After New

Design

User Story
As a Salesforce User
I want the system to prevent a case being moved past the New status if it is owned by a queue
So that user do can't forget to assign the case to a user
Acceptance Criteria
Given I am on a Case record page
When I change the case status to a value other than New
Then an error message is displayed if the case is owned by a queue

Build

Rule Name: Enforce_User_Assignment_After_New
Description: The rule checks if the OwnerId starts with "00G", which indicates that the owner is a queue.
Error Condition Formula:

AND(
    NOT(ISPICKVAL(Status, "New")),
    BEGINS(OwnerId, "00G")
)

Error Message: Please accept the case or manually choose a case owner. To move the status forward, the case needs to be owned by a user, not a queue
Error Location: Case Owner

Test

Steps

  1. Open a Case record page
  2. Set the Owner to a queue
  3. Change the status to a value other than New
  4. Click Save
  5. An error message is displayed

Expected Results

  1. An error message is displayed
  2. The error message should read 'Please accept the case or manually choose a case owner. To move the status forward, the case needs to be owned by a user, not a queue'

Prevent Owner To Unauthorised User

Design

User Story
As a Salesforce User
I want the system to prevent changing the Case owner to a user who does not have the specified role
So that the case is always owned by a user with the specified role
 
```sfstory filename="Acceptance Criteria"
Given I am on a Case record page
When I change the case owner
Then an error message is displayed if the new owner does not have the specified role

Build

Rule Name: Prevent_Owner_To_Unauthorised_User
Description: This rule prevents changing the Case owner to a user who does not have the specified role or the System Administrator profile. It checks if the OwnerId has changed and that the new OwnerId does not begin with "00G" (indicating a queue). This allows the Case to be owned by any queue or by a user with the specified role or System Administrator profile.
Error Condition Formula:

AND(
    ISCHANGED(OwnerId),
    NOT(BEGINS(OwnerId, "00G")),
    NOT(
        OR(
            CONTAINS(Owner:User.UserRole.Name, "SPECIFIED_ROLE"),
            Owner:User.Profile.Name = "System Administrator"
        )
    )
)

Error Message: The owner can only be changed to a user with the {SPECIFIED_ROLE} role
Error Location: Case Owner

Test

Steps

  1. Open a Case record page
  2. Change the Owner to a user without the specified role
  3. Click Save
  4. An error message is displayed

Expected Results

  1. An error message is displayed
  2. The error message should read 'The owner can only be changed to a user with the {SPECIFIED_ROLE} role'