Notification of returning visitor

Trigger a Salesforce notification when a flagged visitor returns to the website.

  1. Create a new checkbox field on the object used for visitor identification, e.g. Lead. This will be used to flag when notification is required.

  2. In setup, create a new Custom Notification Type with a name of your choosing.

  3. Create a new Record Triggered Flow that acts when a new send2crm Session record is created.

  4. Add a Decision that tests the checkbox field on the related Lead from step 1. End the Flow if not checked.

  5. Add a Get Records element that loads the Custom Notification Type created in step 2. Filter by the DeveloperName field using the API name of the type created.

  6. Create a multi-valued Text variable to hold the list of recipients. Add an Assignment element that adds the Lead owner to this list.

  7. Create a Formula of type Text to generate the message text. Build your message with record variables such as name, for example:
    TEXT({!$Record.send2crm__Started__c}) + ": " + {!$Record.send2crm__Visitor__r.send2crm__Lead__r.FirstName} + " " + {!$Record.send2crm__Visitor__r.send2crm__Lead__r.LastName} + " has returned to the website"

  8. Add a Send Custom Notification element, and set the following values:

    • Custom Notification Type Id: from record loaded at step 5

    • Notification Body: from formula at step 7

    • Notification Title: as desired, e.g. “Website visitor has returned”

    • Recipient Ids: from variable at step 6

    • Target Id: {!$Record.send2crm__Visitor__r.send2crm__Lead__c}

  9. Optionally, add an Update Records element that un-checks the flag on the Lead so the notification does not repeat unless explicitly enabled again.

  10. Save and activate the Flow.

When a new Session record is created for a visitor whose related Lead has the flag field checked, a notification will be shown to the Lead owner.

Adjust the steps above to suit your needs:

  • Different related object than Lead

  • Send email instead of or in addition to notification

  • Different recipients

For more advanced functionality this process could be implemented as an Apex trigger instead of a Flow.