Back to Top

How to Send Custom Push Notifications to the Salesforce Field Service Mobile App.

Updated 25 September 2024

In this blog, we will learn how to use custom notification types to send push notifications to the Field Service Mobile App with the help of a record-triggered flow.

Push notifications in the Field Service Mobile App will alert your mobile workforce to upcoming appointments, scheduling changes, or other events.

Prerequisite – Install the connected app in the org along with the Field Service Lightning managed package.

Why Use Field Service Mobile App?

The Field Service mobile app for Android and iOS offers a comprehensive tool for today’s mobile workforce.

Built with an offline-first approach, it allows you to work and save changes even without internet access. You can also customize the app to meet your specific business requirements.

Searching for an experienced
Salesforce Company ?
Find out More

What is Push Notification?

A push notification sends a message to a user’s device, such as a smartphone, tablet, or computer, even when the app is not in use.

These notifications appear as alerts, banners, or pop-ups and deliver important updates, reminders, offers, or other information to engage users.

Businesses and apps use push notifications to provide real-time alerts, like upcoming appointments or changes, enhancing user engagement and communication.

What is Custom Notification Type?

Custom notification types define the text your users see when they get a notification of that type. They also create custom action elements in the Flow Builder to send the right notifications.

How to Create a Custom Notification Type?

  1. From Setup, in the Quick Find box, enter “Custom Notifications“, and then select “Custom Notifications“.
  2. In the Custom Notification Name enter any name of your choice
  3. In the Supported channels select Mobile.
Custom Notification Type

Notification Delivery Settings

Notification Delivery Settings lets you control where your notifications appear and which apps deliver them. You can select the delivery channels or mobile apps.

For Custom Notifications, you can modify the delivery channels for both Salesforce-provided apps and those installed from managed packages.

However, for standard notifications, you can only adjust the delivery channels for Salesforce-provided apps.

Configure Notification Delivery Settings

  1. From Setup, enter “Notification Builder” in the Quick Find box, then select “Notification Delivery Settings”.
  2. Choose the notification type you created in the previous step, and click “Edit” from the dropdown menu.
    The Notification Delivery Settings page displays only the notification types available for your org.
  3. In the supported channels select Mobile and in the Mobile Apps select Salesforce Field Service for iOS and Salesforce Field Service for Android and click Save.
Notification Delivery Setting


What does a Record-Triggered Flow do?

A record-triggered flow in Salesforce lets you automate actions seamlessly behind the scenes whenever you create, update, or delete a record, eliminating the need for user interaction.

Similar to workflow rules and processes, these flows activate when you create or update a record, streamlining your Salesforce automation efforts.

Create a Record Triggered Flow

Consider a scenario where you send a custom push notification to the assigned resource when the Service Appointment Status is marked as “Completed.”

Start Record Triggered Flow
Flow Type

Set the Start conditions as follows

  • Select Object: Service Appointment
  • Trigger the flow when: Record is updated
  • Set Entry Condition: All conditions are met(AND), Status equals “Completed
  • When to Run the Flow for Updated Records: Only when a record is updated to meet the condition requirements.
  • Optimize the flow for: Actions and related record
Start Condition 1
Start Condition 2

Create the following collection variable 

  • ResourceUserIds – for storing the User record ID of the Assigned Service Resource records.
ResourceUserIds collection variable

Create the following constants

  • CustomNotificationName – To store the API name of the Custom Notification Type.
CustomNotificationName constant
  • NotificationTitle – To store the title for the push notification.
NotificationTitle constant
  • NotificatonBody – To store the body of the push notification.
NotificatonBody constant

Add a “Get Records” element after the Start element to retrieve all Assigned Resource records for the triggering Service Appointment.

  • Get Records of This Object: Assigned Resource.
  • Filter Assigned Resource Records: All Conditions Are Met (AND), ServiceAppointmentId Equals Triggering Service Appointment’s record ID.
  • Sort Assigned Resource Records: Not Sorted
  • How Many Records to Store: All Records
  • How to Store Record Data: Automatically Store All Fields
Get Assigned Resource

Add a “Get Records” element after retrieving the Assigned Resource record to fetch the Custom Notification Type record.

  • Get Records of This Object: Custom Notification Type
  • Filter Custom Notification Type Records: All Conditions Are Met (AND), DeveloperName Equals CustomNotificationName.
  • Sort Assigned Resource Records: Not Sorted
  • How Many Records to Store: Only the First Record
  • How to Store Record Data: Automatically Store All Fields
Get Custom Notification type

After the “Get Custom Notification Type” element add a Loop element to iterate the Assigned Resource Records.

  • Select Collection Variable: Get Assigned Resource
  • Specify Direction for Iterating Over Collection: First item to last item.
Loop Assigned Resource

Inside the Loop add a Decision element to check the User ID of the Assigned Resource.

  • We add this check because when a Service Appointment is assigned to a crew, no User is associated with the Crew Resource, leaving the User ID null.
  • Label: Check User Id
  • API Name: Check_User_Id
  • Outcomes: “Present” denotes that the User ID is present
  • Condition Requirements to Execute Outcome: All Conditions Are Met (AND)
  • Condition: {!Loop_Assigned_Resource.ServiceResource.RelatedRecordId} Is Null False
  • When to Execute Outcome: If the condition requirements are met
Check User Id

Add an assignment element in the “Present” branch of the decision element to add the User IDs of the Assigned Resources to the ResourceUserIds collection variable.

Add Resource User Id

 

Add an action element after the Loop ends of type Send Custom Notification and Set Input Values for the Selected Action

  • Custom Notification Type ID: The record ID of the Custom Notification Type retrieved above.
  • Notification Body: NotificationBody constant.
  • Notification Title: NotificationTitle constant.
  • Recipient IDs: ResourceUserIds collection variable.
  • Target ID: Triggering Service Appointment ID. 
Send Custom Notification

Save and Activate the Flow

When the Service Appointment Status changes to “Completed,” users will receive the following type of notification on the Field Service Mobile App.

Notification on Mobile Device

Conclusion

The Field Service Mobile App is a powerful tool designed for field technicians to efficiently manage tasks on the go.

It offers customizable features that integrate seamlessly with Salesforce Field Service, enabling businesses to streamline operations and enhance customer satisfaction.

Additionally, Custom Push Notifications keep mobile workers informed about key events in real-time, based on specific business needs.

For any queries regarding Field Service Lightning or personalized solutions, contact our expert Salesforce Consultants at [email protected] or via Live Chat.

Our team is available year-round to provide customized solutions tailored to your business needs.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home