Desktop or Mobile Notifications

Simon Maskell Updated by Simon Maskell

The steps below show you how you can create a Salesforce Flow to send a custom desktop or mobile notification to a user on assignment of a record in DE. This uses the Notification Builder functionality within Salesforce and more information can be found here.

Note: the labels used in the example are just suggestions, you can set them to whatever you like.

Step 1 - Create the notification

  • Go to Setup > Notification Builder > Custom Notifications
  • Click New
  • Depending on your configuration, you may have multiple notification types to choose from. If prompted, select "Salesforce Desktop or Mobile" and click Next
    • Custom Notification Name: DE Notification
    • Support Channels: <Choose at least one>
  • Click Save

Step 2 - Get the id of the notification

You need the id of the notification created in step 1 to use in the Flow. There are different ways of getting this depending on your level of access, but you may need to contact a Salesforce admin to help you. In this example, we are using the Developer Console.

  • Open the Developer Console from the Settings menu
  • Click on the Query Editor tab and paste in the query SELECT Id, CustomNotifTypeName FROM CustomNotificationType
  • Click Execute
  • Copy the id for the custom notification returned in the results

Step 3 - Create the flow

  • Go to Setup > Process Automation > Flows
  • Click New Flow
  • Select "Platform Event-Triggered Flow"
  • Click Create
  • Click "Choose Platform Event" in the Start step and search for "n2de__Distribution_event__e"
  • Click Done

Step 4 - Filter only assignment events

  • Click the Add Element button and select "Decision"
    • Label: Check Assignment
    • Outcome details Label: Is Assignment
    • Condition Resource: {!$Record.n2de__Event_type__c}
    • Condition Operator: Equals
    • Condition Value: Assigned
  • Click Done

Step 5 - Create the recipients variable

The notification action requires a list of recipients, but because we only have one in the event we need to convert that to a list.

  • In the Toolbox on the left, click New Resource
    • Resource Type: Variable
    • API Name: Recipients
    • Data Type: Text
    • Allow multiple values (collection): Check
  • Click Done

Step 6 - Populate the recipients

  • In the "Is Assignment" branch, click the Add Element button and select "Assignment"
    • Label: Set Recipients
    • Variable: {!Recipients}
    • Operator: Add
    • Value: {!$Record.n2de__Assigned_owner__c}
  • Click Done

Step 7 - Send the notification

  • In the "Is Assignment" branch, click the Add Element button and select "Action"
  • Search for the Action "Send Custom Notification"
    • Label: Send Notification
    • Custom Notification Type ID: <The Id of the notification collected in step 2>
    • Notification Body: Enter a message of your choosing, which can also contain variables from the platform event, for example "{!$Record.n2de__Assigned_record_name__c}" for the record name
    • Notification Title: Enter a title of your choosing
    • Recipient IDs: {!Recipients}
    • Target ID: {!$Record.n2de__Assigned_record_id__c}
  • Click Done
  • You will end up with the following Flow

Step 8 - Save the flow

  • Click Save on the toolbar
    • Flow Label: Send Notification on Assignment
  • Click Save
  • Click Activate on the toolbar

Step 9 - Enable sending platform events

  • See Distribution Settings for more information on enabling the sending of platform events on assignment
  • Ensure the "Publish platform events on assignment" checkbox is checked in Distribution Settings
This is an example flow, it is recommended to include fault handling and fully test the flow before activating in production.

How did we do?

Slack Notifications

Custom Assignment Rejection

Contact