Custom Assignment Rejection

Simon Maskell Updated by Simon Maskell

There are different ways that a user can reject an assignment in DE. Some of the options are via the Distribution Logs page, the Record Detail Component or the Widget. This article goes through an example of using a Salesforce Flow with our Rejection API that could be triggered from a button on the record page.

Step 1 - Create the flow

  • Go to Setup > Process Automation > Flows
  • Click New Flow
  • Select "Screen Flow"
  • Click Create

Step 2 - Add record id resource

In order to pass in a record to a screen flow, a resource needs to be created with the name "recordId".

  • In the Toolbox on the left, click New Resource
    • Resource Type: Variable
    • API Name: recordId
    • Data Type: Record
    • Object: The relevant object type
    • Available for input: Check
  • Click Done

Step 3 - Create the screen

It's up to you what you want to include on the screen. It could show details of the current record, it could prompt the user for questions to determine why they are rejecting it or what the next steps should be. In terms of what information DE needs, it requires the id of the record and a reason for the rejection. If specific rejection reasons are configured, then that reason must match one of those from the configured list.

For this example we will just configure the flow screen to ask the user to select from a predefined list of rejection reasons.

  • Click the Add Element button and select "Screen"
    • Label: Assignment Rejection
  • Select "Picklist" from the Components on the left
    • Label: Rejection Reason
    • Choice: Add your rejection reasons - these will be created as resources
  • Click Done

Step 4 - Reject the record

This step uses the DE Rejection API, see this article for more information.

  • Click the Add Element button and select "Action"
  • In the category "Distribution Engine" search for the action "DE Reject Record"
    • Label: Reject Record
    • Reason to reject: Under "Screen Components" select the Picklist "Rejection_Reason"
    • Record id: {!recordId.Id}
  • Click Done

Step 5 - Display errors

There are some reasons why the assignment rejection process may fail, these are detailed at the end of the Rejection API article. Due to this, it is useful to handle these errors and inform the user why something failed. In this example we will display the errors on the screen.

  • Click the Reject Record action and select "Add Fault Path"
  • On the fault path click the Add Element button and select "Screen"
    • Label: Rejection Failed
  • Select "Display Text" from the Components on the left
    • API Name: Failure_Message
    • Contents: An error occurred while rejecting this record: {!$Flow.FaultMessage}
  • Click Done

  • You will end up with the following Flow

Step 6 - Save the flow

  • Click Save on the toolbar
    • Flow Label: Reject Assignment
  • Click Save
  • Click Activate on the toolbar

Step 7 - Trigger the flow

The flow can by triggered in a few different ways, one option is to create an action button and add it to the page.

  • Go to Setup > Object Manager
  • Select the relevant object type
  • Click Buttons, Links and Actions
  • Click New Action
    • Action type: Flow
    • Flow: Reject Assignment
    • Label: Reject Assignment
  • Click Save
  • Back in the object manager, click Page Layouts
  • Select which layout you want to add the button to
    • If not already done, click the "override the predefined actions" link in the "Salesforce Mobile and Lightning Experience Actions" section
    • In the actions bar at the top select "Mobile & Lightning Actions"
    • Drag the Reject Assignment button onto the "Salesforce Mobile and Lightning Experience Actions" section
  • Click Save

How did we do?

Desktop or Mobile Notifications

Classify on Address Change

Contact