Newer Version Available

This content describes an older version of this product. View Latest

Programmatic Navigation Actions

Some features require more complicated navigation designs. For the most complete control of your user interface and navigation scheme, define navigation actions using JavaScript.

In Lightning web components, navigation actions are built using the navigation service, provided by the lightning/navigation module. See Navigate to Different Page Types in the Lightning Web Components Developer Guide to get started.

This module is supported for use, however, the navigation service currently has an incomplete understanding of the different page types within the Field Service mobile app. This limits the kinds of pages you can programmatically navigate to from your LWCs. Currently, the only PageReference type supported with the LWC navigation service within the Field Service mobile app is:
  • standard__webPage

While that sounds limiting, you can implement a surprising number of different navigation actions using it. The following are examples of navigation actions, and the PageReference used to implement them.

Navigate from LWC to a Native Screen
Create a navigation action that moves from a LWC to a screen native to the Field Service mobile app. 
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": `com.salesforce.fieldservice://v1/sObject/${this.recordId}/details`
5    }
6}

There’s a wide range of targets available for deep linking into the Field Service mobile app. See Deep Linking Schema for the Field Service Mobile App in the Field Service Developer Guide for available URL formats.

Navigate to a Quick Action via Deep Link
Create a navigation action that opens a quick action, including quick actions built with LWCs. 
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": `com.salesforce.fieldservice://v1/sObject/${this.recordId}/quickaction/<api_name>`
5    }
6}

This action can also be used as a deep link into the Field Service mobile app. See Deep Linking Schema for the Field Service Mobile App in the Field Service Developer Guide for additional details.

Open Salesforce Mobile App via Deep Link
Create a navigation action that leaves the Field Service mobile app, and opens a specific page in the Salesforce mobile app.
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": "salesforce1://sObject/WorkOrder/home"
5    }
6}
See Salesforce Mobile App URL Schemes for available URL formats.
Open Web Page
Create a navigation action that opens a screen that displays an external web page.
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": "https://salesforce.com"
5    }
6}
Open Email App
Create a navigation action that opens the device’s native email client and pre-fills the addressee and subject lines.
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": "mailto:help@AcmeSupport.com?subject=Help with Asset"
5    }
6}
Open Phone App
Create a navigation action that opens the device’s native phone app, and dials a phone number.
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": "tel:123-456-7890"
5    }
6}
Open Message App
Create a navigation action that opens the device’s native SMS or message app, and pre-fills the recipient phone number.
1{
2    "type": "standard__webPage",
3    "attributes": {
4        "url": "sms:12345678"
5    }
6}