You are here:
External Events
External events originate outside the Consumer Goods Cloud mobile app's user interface, such as barcode scans or app-to-app integration via deep links.
Required Editions
Available in: Lightning Experience Available in: Enterprise and Unlimited Editions that have Consumer Goods Cloud enabled |
barcodeEvent for Barcode Scanning
When you scan a barcode from the Consumer Goods (CG) Cloud mobile app, for example, a
fridge ID on an assets page, the app framework triggers an external event handler. The
barcode information is passed as the event.code to a specified action. This
action then transitions to a business logic function, using the event.code
as an input parameter. This mechanism facilitates barcode scanning functionality. You can
add only one barcode event to a process contract that has a valid existing action assigned
to it.
In this sample code, the barcodeEvent external event triggers the action
PreviousScanProduct_External_StatusDecision. This event handles the
status decision for a previously scanned product, ensuring that the workflow responds to
barcode scanning events and takes appropriate actions based on the scanned data.
<Action name="externalBarcodeScanning" actionType="LOGIC" call="ProcessContext::ClbBO.loCallAssetOverview.trimBarcode">
<Return name="ProcessContext::EAN" />
<TransitionTo action="ScanBarcode_Decision" />
<Parameters>
<Input name="value" value="event.code" />
</Parameters>
</Action>
</Actions>
</Body>
<ExternalEvents>
<Event name="barcodeEvent" action="PreviousScanProduct_External_StatusDecision" />
</ExternalEvents>linkLaunchEvent for App-to-App Integration Through Deep Link
When the CG Cloud app receives data over an incoming deep link from an internal or external
mobile app, linkLaunchEvent registers an action that the CG Cloud mobile
app invokes for this process flow. The URL contains an event payload and a success flag that
you can access and use in a business function for processing or analysis. See Considerations
and Guidelines for Deep Link Setup on how to create the URL for a deep link to the CG Cloud
mobile app.
In this sample code snippet, the linkLaunchEvent external event triggers
the AddProduct action. This event adds a product to the product list when a
specific mobile app link is launched.
<Action name="AddProduct" actionType="LOGIC" call="ProcessContext::ProductList.addProduct">
<Parameters>
<Input name="success" value="event.success"/>
<Input name="data" value="event.data" />
</Parameters>
</Action>
</Actions>
</Body>
<ExternalEvents>
<Event name="linkLaunchEvent" action="AddProduct" />
</ExternalEvents>agentforceLaunchEvent for Agentforce Context Customization
When a sales rep starts the Agentforce conversation from their mobile app,
agentforceLaunchEvent is triggered on the current process and the
associated action in that process is executed. You can configure the business logic to
create a context payload such as the current object and record ID to pass to Agentforce.
In this sample code snippet, the agentforceLaunchEvent external event triggers
the LaunchAgentforce action. This action retrieves the context parameters
(Object Name and Record ID) and calls the business logic function to launch the agent with
that context.
<Action actionType="LOGIC" name="LaunchAgentforce" call="ProcessContext::CardController.launchAgentforce">
<Parameters>
<Input name="objectName" type="Literal" value="Visit" />
<Input name="recordId" type="Binding" value="ProcessContext::mainBO.PKey" />
</Parameters>
</Action>
</Actions>
</Body>
<ExternalEvents>
<ExternalEvent name="agentforceLaunchEvent" action="LaunchAgentforce" />
</ExternalEvents>
