Skip to content
Custom Notification Demos
Branch: master
Clone or download
Latest commit 7b21574 Jul 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Initial commit Jun 30, 2019
force-app/main/default Update CustomNotification.cls Jun 30, 2019
.forceignore Initial commit Jun 30, 2019
.gitignore Initial commit Jun 30, 2019
.prettierignore Initial commit Jun 30, 2019
.prettierrc Initial commit Jun 30, 2019 Update Jul 1, 2019
sfdx-project.json Initial commit Jun 30, 2019

Custom Notification Demos

Sample Process Builder, Flow and Apex code illustrating how to utilizae Custom Notifications in Lightning Experience and Salesforce Mobile. See blog for more details.

Setup Instructions

  • Deploy to DX scratch org via sfdx force:source:push
  • Run the query sfdx force:data:soql:query -q "select id, developername from CustomNotificationType" --usetoolingapi
  • Update the file with the Id returned by the query.
  • Run sfdx force:source:push again

NOTE: The need to define a Name to Id map for Notification Types is only required when sending Custom Notifications from Flow at time of writing. Process Builder does not require this. If you want to get the Id of the Notification Type in a regular org run select id, developername from CustomNotificationType from the Developer Console and ensure you to tick the "Use Tooling API" checkbox.

Demo Instructions

  • Open the scratch org with sfdx force:org:open
  • Run sfdx force:apex:execute (without parameters)
  • Paste the following sample code in and press the indicated keyboard shortcut to run the code.
new CustomNotification()
    .title('Batch Error')
    .body('Some useful information')

Or to test the Batch Apex Error Event handler....

Database.executeBatch(new MyBadJob());

Finally if you want to see notifications on your mobile, you will need to generate a user password via sfdx force:user:password:generate to login to the scratch org (be sure to select sandbox login from the mobile).

You can’t perform that action at this time.