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.
This information is for Omnistudio for Managed Packages. For Omnistudio on standard
runtime, see Omnistudio Help.
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:
-
Request the Done Action with Lightning Refresh Example datapack from Salesforce Support.
-
Replace the Done action's template with a custom template using the template provided in the datapack as a reference.
-
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) in the Lightning Component Reference.