Navigate Action Lightning Web Component ReadMe (Managed Package)

For the managed package runtime, this page contains a Navigate Action LWC ReadMe for each Vlocity release.

Managed Package app icon This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see Omnistudio Help.

Vlocity Insurance and Health Spring '20

The NavigateAction Lightning Web Component enables navigation to any of Salesforce's PageReference types, by leveraging Salesforce's navigation service.

Available c-navigate-action Attributes

Attribute

Value

Type

Required

Description

targetType

App, Component, Knowledge Article, Login, Object, Record, Record Relationship, Named Page, Community Named Page, Navigation Item, Web Page, Current Page

string

yes

Specifies the name of the target PageReference type. Pass undefined for the current PageReference.

targetId

 

string

 

Specifies the 18 character record ID.

targetName

 

string

 

Specifies the API name of the component, object, tab, app or record.

targetParams

 

string

 

Adds state params sent to the target page reference.

targetAction

 

string

 

Specifies action passed to object, login and record targetType.

targetArticleType

 

string

 

If the targetType is knowledgeArticle, specifies the articleType API name of the Knowledge Article record. In Communities, articleType is ignored.

targetRelationship

 

string

 

Specifies the API name of the object’s relationship field.

replace

true or false (Default: false)

boolean

 

To call the navigate() function to replace the current entry in window.history, set to true.

useHref

true or false (Default: false)

boolean

 

To wrap with an anchor tag, set to true.

openTargetIn

newTab, currentTab

string

 

Specifies whether to open the target in a new tab or the current tab.

url

 

string

 

Read-only property that displays the value of the generated url when useHref is set to true.

pageReference

 

string

 

Read-only property that gets the generated page reference object for the given properties.

Example c-navigate-action Component

The navigate-action component renders a single template, and is designed to attach functionality onto the slotted markup.

<c-navigate-action
  target-type="{string}"
  target-name="{string}"
  target-id="{string}"
  target-params="{string}"
  target-action="{string}"
  replace
  use-href
>
  <!-- content -->
</c-navigate-action>

Configure c-navigate-action to Navigate to a Salesforce Tab

Navigate to any app tab or Lightning page by setting target-type to 'navigation item', and target-name (found in the url when viewing the app tab or page, such as /n/namespace__Target_Name).

Notenamespace must be replaced with actual the namespace in your org.

<c-navigation-action target-type="Navigation Item"
    target-name="namespace__LWC_Designer">
    <!-- pass in desired content -->
</c-navigate-action>

Configure c-navigate-action to Navigate to a Component

Navigate to an aura component by specifying the target-type="Component" and target-name attributes where the aura components name is the value of target-name.

Currently Lightning web components must be wrapped in an aura component that implements the lightning:isUrlAddressable interface.

<c-navigate-action
  target-type="Component"
  target-name="c__example_aura_wrapper"
>
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to navigate to update the current page reference

To update the CurrentPageReference.state, use a navigation action that excludes the target-type attribute. Values passed in target-params are added to the current state.

<c-navigate-action target-params="c__paramone=value one&c__layout=newport">
  <!-- pass in desired content -->
</c-navigate-action>

To remove parameters from the CurrentPageReference.state, set the param to an empty value. In the following example, executing the navigation removes the view parameter from the PageReference.state.

<c-navigate-action target-params="c__paramone=">
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to Navigate to a Record

Navigate to an action by setting target-type to 'record', a target-id, and a target-action (clone, edit, or view). By default the target-actionvalue is 'view'.

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Open the Default Salesforce Edit Dialogue

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-action="edit"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Available Methods

NavigationAction.navigate()

Performs navigation to the PageReference that is constructed via the passed attributes. Calls NavigationMixin.Navigate(). The generated pageReference is returned.

NavigateAction.generateUrl()

Returns a promise that resolves the value of the configured PageReference URL and updates the tracked property url. This method is called on connectedCallback. Note, if useHref is set to true and properties are updated after component initialization, generateUrl must be called manually.

Vlocity Insurance and Health Winter '20 and Vlocity CME Spring '20

The NavigateAction Lightning Web Component enables navigation to any of Salesforce's PageReference types, by leveraging Salesforce's navigation service.

Properties

Name

Scope

Description

targetType

api (public)

{string} The name of the target PageReference type. One of - component, knowledgeArticle, object, record, relationship, tab, web - Pass undefined for the current PageReference.

targetId

api (public)

{string} - The 18 character record ID.

targetName

api (public)

{string} - Name of the component, object, tab or record.

targetParams

api (public)

{string} - State params sent to the target page reference.

targetAction

api (public)

{string} - Action passed to object, and record references.

targetArticleType

api (public)

{string} - The articleType API name of the Knowledge Article record. In Communities, articleType is ignored.

targetRelationship

api (public)

{string} - The relationship name of the record.

replace

api (public)

{boolean} - When replace is true, calling the navigate() will replace the current entry in window.history.

useHref

api (public)

{boolean} - If true, wrap the slot with an anchor tag.

openTargetIn

api (public)

{string} - To open the target in newTab/currentTab.

url

track (private)

{string} - When useHref is true, the value of the generated url.

pageReference

private get

{PageReference} - The generated page reference object for the given properties.

Methods

Signature

Scope

Return Value

Description

navigate

public

PageReference

Calls lightning/navigation NavigationMixin.navigate() with the configured attributes.

generateUrl

public

Promise

Generates a url value based on the configured attributes.

Markup

The navigate-action component renders a single template, and is designed to attach functionality onto the slotted markup.

Usage

<c-navigate-action
  target-type="{string}"
  target-name="{string}"
  target-id="{string}"
  target-params="{string}"
  target-action="{string}"
  replace
  use-href
>
  <!-- content -->
</c-navigate-action>

Example Usage

Configure c-navigate-action to Navigate to a Salesforce Tab

Navigate to any app tab or Lightning page by setting target-type to 'navigation item', and target-name (found in the url when viewing the app tab or page /n/namespace__Target_Name).

Notenamespace must be replaced with actual the namespace in your org.

<c-navigation-action target-type="Navigation Item"
    target-name="namespace__LWC_Designer">
    <!-- pass in desired content -->
</c-navigate-action>

Configure c-navigate-action to Navigate to a Component

Navigate to an aura component by specifying the target-type="Component" and target-name attributes where the aura components name is the value of target-name.

Currently Lightning web components must be wrapped in an aura component that implements the lightning:isUrlAddressable interface.

<c-navigate-action
  target-type="Component"
  target-name="c__example_aura_wrapper"
>
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to navigate to update the current page reference

To update the CurrentPageReference.state, use a navigation action that excludes the target-type attribute. Values passed in target-params are added to the current state.

<c-navigate-action target-params="c__paramone=value one&c__layout=newport">
  <!-- pass in desired content -->
</c-navigate-action>

To remove parameters from the CurrentPageReference.state, set the param to an empty value. In the following example, executing the navigation removes the view parameter from the PageReference.state.

<c-navigate-action target-params="c__paramone=">
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to Navigate to a Record

Navigate to an action by setting target-type to 'record', a target-id, and a target-action (clone, edit, or view). By default the target-action value is 'view'.

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Open the Default Salesforce Edit Dialogue

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-action="edit"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Available Methods

NavigationAction.navigate()

Performs navigation to the PageReference that is constructed via the passed attributes. NavigationMixin.Navigate() is called, and the generated pageReference is returned.

NavigateAction.generateUrl()

Returns a promise that resolves the value of the configured PageReference URL and updates the tracked property url. This method is called on connectedCallback. Note, if use-href is set to true and properties are updated after component initialization, generateUrl must be called manually.

Vlocity Insurance and Health Summer '19 and Vlocity CME Fall '19

The NavigateAction Lightning Web Component enables navigation to any of Salesforce’s PageReference types, by leveraging Salesforce’s navigation service.

Properties

Name

Scope

Description

targetType

api (public)

{string} The name of the target PageReference type. One of - component, knowledgeArticle, object, record, relationship, tab, web - Pass undefined for the current PageReference.

targetId

api (public)

{string} - The 18 character record ID.

targetName

api (public)

{string} - Name of the component, object, tab or record.

targetParams

api (public)

{string} - State params sent to the target page reference.

targetAction

api (public)

{string} - Action passed to object, and record references.

targetArticleType

api (public)

{string} - The articleType API name of the Knowledge Article record. In Communities, articleType is ignored.

targetRelationship

api (public)

{string} - The relationship name of the record.

replace

api (public)

{boolean} - When replace is true, calling the navigate() will replace the current entry in window.history.

useHref

api (public)

{boolean} - If true, wrap the slot with an anchor tag.

openTargetIn

api (public)

{string} - To open the target in newTab/currentTab.

url

track (private)

{string} - When useHref is true, the value of the generated url.

pageReference

private get

{PageReference} - The generated page reference object for the given properties.

Methods

Signature

Scope

Return Value

Description

navigate

public

PageReference

Calls`lightning/navigation NavigationMixin.navigate()` with the configured attributes.

generateUrl

public

Promise

Generates a url value based on the configured attributes.

Markup

The navigate-action component renders a single template, and is designed to attach functionality onto the slotted markup.

Usage

<c-navigate-action
  target-type="{string}"
  target-name="{string}"
  target-id="{string}"
  target-params="{string}"
  target-action="{string}"
  replace
  use-href
>
  <!-- content -->
</c-navigate-action>

Example Usage

Configure c-navigate-action to Navigate to a Salesforce Tab

Navigate to any app tab or Lightning page by setting target-type to `navigation item', and target-name (found in the url when viewing the app tab or page /n/namespaceTarget_Name__).

Notenamespace must be replaced with actual the namespace in your org.

<c-navigation-action target-type="Navigation Item"
    target-name="namespace__LWC_Designer">
    <!-- pass in desired content -->
</c-navigate-action>

Configure c-navigate-action to Navigate to a Component

Navigate to an aura component by specifying thetarget-type=``Component'' and target-name attributes where the aura components name is the value of target-name.

Currently Lightning web components must be wrapped in an aura component that implements the lightning:isUrlAddressable interface.

<c-navigate-action
  target-type="Component"
  target-name="c__example_aura_wrapper"
>
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to navigate to update the current page reference

To update the CurrentPageReference.state, use a navigation action that excludes the target-type attribute. Values passed intarget-params are added to the current state.

<c-navigate-action target-params="c__paramone=value one&amp;amp;c__layout=newport">
  <!-- pass in desired content -->
</c-navigate-action>

To remove parameters from the CurrentPageReference.state, set the param to an empty value. In the following example, executing the navigation removes the view parameter from the PageReference.state.

<c-navigate-action target-params="c__paramone=">
  <!-- pass in desired content -->
</c-navigate-action>

Configuring c-navigate-action to Navigate to a Record

Navigate to an action by setting target-type to `record', atarget-id, and a target-action (clone, edit, or view). By default the target-action value is `view'.

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Open the Default Salesforce Edit Dialogue

<c-navigate-action
  target-type="Record"
  target-name="Account"
  target-action="edit"
  target-id="001B000000vYIINIA4"
>
  <!-- pass in desired content -->
</c-navigate-action>

Available Methods

NavigationAction.navigate()

Performs navigation to the PageReference that is constructed via the passed attributes. NavigationMixin.Navigate() is called, and the generated pageReference is returned.

NavigateAction.generateUrl()

Returns a promise that resolves the value of the configured PageReference URL and updates the tracked property url. This method is called on connectedCallback. Note, if use-href is set to true and properties are updated after component initialization, generateUrlmust be called manually.