Summer 19′ new feature alert! Have you combined Flow & custom notifications yet?

Flow: Send Custom Notification Action

Sometimes the smallest new feature catches your eye, and you just want an excuse to use it. That was the situation I was in a few days ago when thinking about the new Custom Notification Builder.

Notifications       Push notification

My work Org is still Classic (shhh!), but I hone my Lightning skills in a personal Developer Edition with wildly over the top objects, processes and automation. 

Now, I could write about the simple notification I set up in Process Builder to congratulate the user when they add a new opportunity, but that is too simple. Setting up notifications in Process Builder is as straight forward as creating a new record, i.e. if you’ve created a couple of processes already, you’ll easily work out what to do. (OK, you win – scroll down to the end of this post for bonus content on how to set this up using Process Builder!)

This post is about creating notifications in Flow, using the Send Custom Notification Action. Currently, there is very little written about the configuration of this Action, and I learnt a few things along the way that need sharing.

This is what the Action looks like in Flow:

Flow 2 CJ

These are the required Input Values:

  • Custom Notification Type ID (required)
  • Notification Body (required)
  • Notification Title (required)
  • Recipient IDs (required)
  • Target ID (required)
  • Sender ID (optional)

Straight forward yes? No, not all of them…

Let’s tackle these in order:

Custom Notification Type ID

In order to create notifications at all, you first have to create a custom Notification Type (Setup > Notification Builder > Notification Types). This consists of the Custom Notification Name, and API Name (auto-populated) and Supported Channels (Desktop, Mobile).

Flow 3 CJ

Once you’ve done that, you need to get the Notification Type ID. But how?

After much searching, and some help from the Trailblazer Community, I was directed to a blog by Narender Singh: How to get the ID of Custom Notification Types in Salesforce?

He explains 3 different ways to get the record ID: Developer Console; inspect the code on a Process Builder page; or Workbench. As an admin who is familiar with the Developer Console, I chose this option.

  1. Open Developer Console
    Where is Dev Console.

  2. In bottom panel, click on Query Editor tabQuery Editor
  3. Check the “Use Tooling API” checkbox
  4. Type the query:

    SELECT Id,CustomNotifTypeName FROM CustomNotificationType

  5. Click ExecuteGet Id
  6. Highlight and copy the Id in the Query Results (you may need to double-click on the Id before you can highlight it)

Notification Body (required)

This is expecting a text string, either from a variable or just typed in. Easy!

Notification Title (required)

Again, this is expecting a text string. Easy!

Recipient IDs (required)

Working out what data type this field expected proved to be the biggest test. Entering a user ID gave the error “The data type of the resource you entered isn’t compatible”. Entering a text string did the same. It wouldn’t accept a Record Variable, or a Collection Variable. So what did it want?

Enter the Answers Community, a question headed Flows: What is the correct data type for Recipient ID in Send Custom Notification Action, and an answer from the photo-less Tajinder Singh.

He explains that while looking for CustomNotificationType he found a topic which says:

Recipient IDs field expects a list of Id’s. You can create a variable with datatype text and checkbox “Allow multiple values (collection)”

So, it wants a Collection Variable, which contains a set of Strings which represent Users, Queues, or Groups, eg: 

Flow 4 CJ

Target ID (required)

This is the Record ID of the object which is the target of the notification. For my example it is the Opportunity record which has just been created.

Sender ID (optional)

This field accepts a text string. What it actually does, however, is a mystery as even when populated the notifications looked the same, and there are no notifications appearing in the Sender’s browser.


Wrapping Up:

Being able to create Custom Notifications means there is no longer a need to send a user an email or post to Chatter when a Flow or Process finishes. Notifications mean the user can receive the information within Salesforce, on their current record, via the bell icon (top right) – or via a push message on their mobile.

Flow 5 CJ       Push notification

As with all new Salesforce features, this is version 1, and it has some issues. But rest assured, Salesforce are continuing to develop this one. In fact, my Community post (about Custom Notification Type record ID) received a comment from a Salesforce Product Manager to say:

“In Summer ’19, you’ll need to get the ID of your notification type in for use in flows. We’ve already got this addressed in Winter ’20 so you won’t need to use this workaround for too long.”


Finally:

For those of you that what to replicate my notification to congratulate users when they add a new opportunity, here’s how! (Don’t forget to setup your custom Notification Type first: Setup > Notification Builder > Notification Types)

Process Builder

  • Object: Opportunity
  • Start the Process: When a record is created or edited

“I try to maintain one master Process per object so I can control the order automation runs in. Hence my process starts when the Opportunity is created or edited and I use Criteria to check for IsNew().”

  • Criteria: Formula evaluates to true
  • Build Formula: ISNEW()
  • Immediate Actions Action Type: Send Custom Notification

Send Custom Notification - Process Builder CJ

Flow

You’ll need to create an Autolaunched Flow, and trigger it to fire using Process Builder. This is the same Custom Notification as Process Builder, but configured in Flow as detailed above.

Flow 11 CJ


Resources:

Salesforce Summer ’19 Release Notes: Keep Users in the Know with Notification Builder

Bob Buzzard Blog: Custom Notifications in Summer 19 Part 1 – Process Builder

Salesforce Help: Developer Console

Trailhead: Developer Console Basics


 

12 thoughts on “Summer 19′ new feature alert! Have you combined Flow & custom notifications yet?

  1. One thing I’ve noticed the past year, and highlighted in this post, is I feel like the PMs are leaving out very important details in the Release Notes or documentation to make these new features even usable. This is at least the 4th such example of this in the past year. We should not have to dig and find some answer in the Community or Stack Exchange for the basic inputs. Why list “Notification Type Id” and then not tell us the crazy way you have to get it. Ok, it’s fine that its a very obtuse reference and we get that this is a factor of a new feature…but tell us HOW to get it and WHAT it is Salesforce!

    Same happened with Knowledge Article Actions and AWS SIgnature Version 4 off top of my head. Helpful post on this feature though!

    Liked by 1 person

  2. I keep getting the error: “Missing required input parameter: recipientIds Missing required input parameter: targetId” Have you seen that at all?

    Like

  3. Question, I”m trying to use flow and custom notification, Scenario: log in flow, that sends a notification to the admins when a user logs in using internet explorer. I have everything I need except i can’t figure out the TARGET ID? because this isn’t record specific, I just want a bell notification for all us admins when a user uses Internet explorer.

    Like

  4. Hi,

    Your post is quite descriptive and helpful in creating the flow. I have a basic query that- do I need to create the Process Builder and call the notification flow through in order to launch it.

    I can see my flow is running when I click on “Run” button. But, it is not creating any notification when the custom object record (on which flow is defined) is created.

    Flow type is – Autolaunched flow.

    I tried to refer this informative video by Salesforce – https://www.youtube.com/watch?v=bLNUoSqHJ80.
    But, as always, this video is incomplete to provide the information about usage.

    Any suggestions would be helpful.

    Thanks,
    Vaibhav

    Like

      1. Many thanks Christine. Using process builder is still required along with flow.

        Keep sharing the awesome Admin posts. I do like them a lot. Also, happy to be contribute my part as a Developer to your blog.

        Thanks,
        Vaibhav

        Liked by 1 person

  5. Thank you so much for your article Claire! It inspired me to write this article of my own for creating Push Notifications of Incoming Text Messages for my Salesforce AppExchange app named 360SMS (Salesforce Integrated Text Messaging and Calling). We already have numerous other ways to notify users of an Incoming SMS but nothing like a push notification on your Phone and Ringing that Bell!

    I gave you a shout out in the article as well!

    Click to access download.php

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s