---
schema_version: "1"
id: 9f169e35cc74907c2fe645cc357e73ec0acd4ddaa4259d3d2ded6a04ba9b73e2
title: Triggering Lightning Events in Omniscript (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_triggering_lightning_events_in_omniscript.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_triggering_lightning_events_in_omniscript.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 848a760f172685bb927b5a4396a27644860c99a597ef820f62402d21ad1a1eb7
description: For the managed package runtime, it is possible to trigger Lightning events from within an Omniscript. For example, you may wish to update an item on a Layout when an Omniscript is completed.
products:
  - Omnistudio
release: "264"
---
# Triggering Lightning Events in Omniscript (Managed Package)

For the managed package runtime, it is possible to trigger Lightning events from within an Omniscript. For example, you may wish to update an item on a Layout when an Omniscript is completed.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

This is accomplished by using JavaScript to perform the following call

if ('parentIFrame' in window) {

window.parentIFrame.sendMessage({

message: 'ltng:event',

event: 'e.force:refreshView'

})

}

The message in the code should always be `'ltng:event'`.

The event in the code should be one of the following events:

- e.force:navigateToComponent
- e.force:navigateToList
- e.force:navigateToObjectHome
- e.force:navigateToRelatedList
- e.force:navigateToSObject
- e.force:navigateToURL
- e.force:refreshView
- e.force:showToast
- e.ltng:sendMessage

If the event has params, the JSON for the params should be specified on a params field like the example below:

if ('parentIFrame' in window) {

window.parentIFrame.sendMessage({

message: 'ltng:event',

event: 'e.force:navigateToComponent',

params: {

componentDef : "c:myComponent", componentAttributes: { contactName : contact.Name

}

}

})

}

To fire a lightning event from a Done Action:

1. Request the Done Action with Lightning Refresh Example datapack from Salesforce Support.
2. Replace the Done action's template with a custom template using the template provided in the datapack as a reference.
3. Write a function to fire the force:refreshView event from the Done Action.

For more information on the force:refreshView event, see [Refresh View (Beta)](https://developer.salesforce.com/docs/platform/lightning-component-reference/guide/force-refresh-view) in the Lightning Component Reference.