您位於此處:
設定 Agentforce 的內容傳送
透過在 Consumer Goods Cloud 行動應用程式中分析內容資料,協助您的工作人員更快速且更準確地工作。您可以在自訂專案中設定流程和業務邏輯契約,以定義應用程式如何建立和傳送此內容。
必要版本
| 提供版本:已啟用 Consumer Goods Cloud 的 Enterprise 和 Unlimited Edition |
| 需要的使用者權限 | |
|---|---|
| 設定 Agentforce 的內容傳遞 | 開發人員、自訂者 |
備註 當您在實體行動裝置上的 Consumer Goods Cloud 行動應用程式中使用 Agentforce 時,便可使用內容傳送。在 Modeler 模擬器應用程式中無法使用。
例如,若要從商店 Cockpit 傳遞造訪識別碼,請執行下列步驟:
- 在以 Visual Studio Code 為基礎的 Modeler 中開啟您的自訂專案。
-
視需要在流程契約中定義
Action邏輯。- 開啟相關的流程契約。
-
實作邏輯,將資料傳送至
Action,或從已可用的物件中提取資料。在此範例中,建立使用物件名稱和記錄識別碼作為輸入參數的邏輯Action,以呼叫自訂業務邏輯。<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:(陣列) 選擇性。額外內容的金鑰值配對。
此文章是否解決您的問題?
請讓我們知道,以便我們改進!

