How to get CustomNotificationTypeId in flows without hardcoding?
Custom notifications are sent to desktop or mobile for anything that needs an user's attention. To get started we need to create a Custom Notification Type by navigating to Setup | Notification Builder | Custom Notifications | New. Creating a custom notification type lets us pick the channels for the notifications (Desktop or Mobile or Both).
Problem:
Once we have the custom notification created, we need the CustomNotificationTypeId for using it with "Send Custom Notification" action in the flow . We can use Developer Console or Workbench to fetch the Id. Problem with fetching the Id and using it hardcoded or storing it in a metadata and using it on a flow are as follows
- The Id will change when the flow is moved from a sandbox to production environment causing the flow to fail.
- Refreshing a sandbox will carry the production Id to sandbox and the flow will fail in sandbox.
Solution:
Using "Get Record" flow component to get the custom notification record.
Get Custom Notification Type record with the Developer Name:
Comments
Post a Comment