How to get the ID of Custom Notification Types in Salesforce?

Hi!

With Summer 19, came an awesome new feature called Notification builder. But, with a weird limitation!

So, for instance, if we were to send custom notifications via a flow instead of a process builder or when you want to publish it via Rest API, we need to input the ID of the Custom Notification Type that we created. So how do we get the ID?

  • By navigating your way through Setup to the Custom Notification Type? Well, you can try you won’t find it.
  • Wait wait, what about SOQL/Apex? Aww… sorry, the object is not API accessible 😦

Shocker right! But what now?

Well, forcePanda to the rescue! 😀
So first, I would want you to upvote these two ideas to make our lives easier.

Expose the ID of the Custom Notification Types on the UI or in URLs

Make CustomNotificationType sObject accessible in SOQL and Flows’ queries

Now let’s discuss 3 ways you can find the the ID of Custom Notification Types

1. Developer Console

– Click on the Gear icon in the top right corner and click on ‘Developer Console’ to open it.
– In the bottom panel, click on Query Editor tab and check the “Use Tooling API” checkbox, and execute the following query:

Select Id,CustomNotifTypeName from CustomNotificationType

2. Process Builder

Go to Setup -> Process Builder. Create a dummy process. In the actions, select ‘Send Custom Notification’ and follow these screenshots.

3. Workbench

CustomNotificationType sObject is accessible via Tooling API. So we can do a query on Tooling API(very similar to what we did in Dev Console) . So for this, go to workbench.developerforce.com.
– Under ‘Utilities’ select Rest Explorer.
– Set Method to GET, and execute this URL:

/services/data/v45.0/tooling/query/?q=SELECT+id,CustomNotifTypeName+from+CustomNotificationType

There you have your sneaky little ID! 😀

Thank you for being an awesome reader! Subscribe to this blog for all the updates delivered straight to your inbox. 🙂

10 thoughts on “How to get the ID of Custom Notification Types in Salesforce?

  1. Pingback: Using Notification Builder in Flows |  forcePanda

  2. Thank you for de-mystifying how to get the Custom Notification Type ID. I queried this on the trailblazer community and was directed to your post (awesome), but also told that it is a short term issue – “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.”
    Good news for us all 🙂

    Like

  3. Pingback: Summer 19′ new feature alert! Have you combined Flow & custom notifications yet? – The Everyday Admin

  4. Thank you so much and especially for that Process Builder method as Professional Edition does not allow one to use the Dev Console query method. Very tricky indeed.

    We used your article and Claire’s to create this cool use case for Push Notifications. I will update the doc to include a shout out to you as well cuz looks like you were the original source.

    Click to access download.php

    Like

  5. Thank you so much and especially for that Process Builder method as Professional Edition does not allow one to use the Dev Console query method. Very tricky indeed.

    We used your article and Claire’s to create this cool use case for Push Notifications. I will update the doc to include a shout out to you as well cuz looks like you were the original source.

    Click to access download.php

    Like

  6. Looks like you could do it from a flow as well if you are already in there. Thanks for the solutions.

    To query for the Notification Type ID directly from a flow, add the Get Record element to your flow and filter by API name. If you’ve installed a notification type via a managed package, filter by the namespace prefix as well as the API name.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.