为 Agentforce 设置上下文传递
通过在 Consumer Goods Cloud 移动应用程序中分析上下文数据,帮助您的客服人员更快、更准确地工作。通过在自定义项目中设置流程和业务逻辑合同,您可以定义应用程序如何构建和发送此上下文。
所需的 Edition
| 适用于:启用了 Consumer Goods Cloud 的 Enterprise 和 Unlimited Edition |
| 所需用户权限 | |
|---|---|
| 要为 Agentforce 配置上下文传递 | 开发人员、自定义人员 |
备注 当您在物理移动设备上的 Consumer Goods Cloud 移动应用程序中使用 Agentforce 时,上下文传递有效。它不适用于 Modeler 模拟器应用程序。
例如,要从商店 Cockpit 传递访问 ID,请执行以下步骤:
- 在基于 Visual Studio 代码的 Modeler 中打开自定义项目。
-
如果需要,在流程合同中定义
Action逻辑。- 打开相关流程合同。
-
实施将数据传输到
Action或从已经可用的对象获取数据的逻辑。在此示例中,创建逻辑Action,该逻辑程序使用对象名称和记录 ID 作为输入参数来调用自定义业务逻辑。<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> -
添加
agentforceLaunchEvent外部事件,并将其绑定到操作。<ExternalEvent name="agentforceLaunchEvent" action="LaunchAgentforce" />
以下是流程合同配置的示例:
<!-- Define the Action to call the Business Logic function --> <Action actionType="LOGIC" name="LaunchAgentforce" call="ProcessContext::CardController.launchAgentforce"> <Parameters> <!-- Pass the Object API Name --> <Input name="objectName" type="Literal" value="Visit" /> <!-- Pass the Record ID dynamically from the current Business Object --> <Input name="recordId" type="Binding" value="ProcessContext::mainBO.PKey" /> </Parameters> </Action> <!-- Define the External Event to intercept the header button click --> <ExternalEvent name="agentforceLaunchEvent" action="LaunchAgentforce" /> -
实施逻辑来构建负载并调用本机门面。
- 打开流程操作中引用的业务逻辑合同。
-
实施与
Action调用中定义的名称匹配的函数。 -
构建包含
objectApiName和属性的 JSON 负载。 -
调用
Facade.launchAgentForce()函数。
以下是业务逻辑实施的示例:
function launchAgentforce(objectName, recordId){ var me = this; ////////////////////////////////////////////////////////////////////////////// // Add your customizing javaScript code below. // ////////////////////////////////////////////////////////////////////////////// var promise; let payload = { "objectAPIName": objectName, "attributes": { "recordId": recordId } }; Facade.launchAgentForce(payload); promise = Promise.resolve(); ////////////////////////////////////////////////////////////////////////////// // Add your customizing javaScript code above. // ////////////////////////////////////////////////////////////////////////////// return promise; }
标记为紧急的特定走访记录的示例负载结构。
{
"objectApiName": "Visit",
"attributes": {
"recordId": "a00xx0000012345AAA",
"pageType": "standard_recordPage",
"actionName": "view"
},
"additionalAttributes": [
{
"name": "customStatus",
"value": "urgent",
"type": "String"
}
]
}参数详细信息:
objectApiName:(字符串)必填。Salesforce 对象上下文的 API 名称。attributes:(对象)必填。记录标识符的容器,特别是 recordId。additionalAttributes:(阵列)可选。额外上下文的键值对。
本文章是否解决您的问题?
请与我们共享您的想法,以便我们进行改进!

