設定特定業務物件整合
在此最後一個區段中,您將執行在特定 Oracle Sales and Service 應用程式業務物件內新增 OCM 內嵌資產儲存庫 UI 所需的步驟。
在此區段中,我們將再次使用服務要求,但您可以使用機會、行銷活動、事件等步驟來更新任何業務物件。這需要服務要求內的自訂欄位,以儲存 OCM 基本資產儲存庫 ID 以及唯一的 OCM 集合 ID。這些步驟也會將「資產」頁籤新增至服務要求詳細資料頁面,該頁面會使用服務要求特定的 OCM 收集 ID,透過混搭顯示 OCM 內嵌資產儲存庫 UI。一旦服務要求解決後,任何相關的 OCM 文件也會複製到 OCM 資產儲存庫集合中。
建立自訂欄位
自訂欄位專用於建立該欄位的業務物件。這些變數可由業務物件存取,且對於所建立之業務物件的每個實例而言是唯一的。
OCM 集合 ID
自訂欄位專用於建立該欄位的業務物件。這些變數可由業務物件存取,且對於所建立之業務物件的每個實例而言是唯一的。
- 若要重新輸入應用程式編寫器,請按一下頁面左上角的工具,然後從下拉式清單中選取應用程式編寫器。
- 依序從左側導覽功能表中依序選擇物件、標準物件、服務要求及欄位。
- 在「欄位」頁面上,選取自訂頁籤,然後按一下建立自訂欄位圖示。
- 在「選取欄位類型」對話方塊中,選取文字選項,然後按一下確定。
- 在「建立文字欄位」頁面上,填好下列欄位:
- 在顯示標籤欄位中,將名稱指定為 OCMCollectionId 。系統會根據顯示標籤欄位中指定的值自動填入名稱欄位。
- 在描述欄位中,輸入文字 「特定服務要求物件的自訂變數 , 以儲存使用 OCM 資產儲存庫記錄管理整合的唯一資產儲存庫集合 ID」。
- 按一下儲存和關閉。
OCM 基本儲存庫 ID
- 在顯示標籤欄位中,將名稱指定為 OCMBaseRepositoryId 。系統會根據顯示標籤欄位中指定的值自動填入名稱欄位。
- 在描述欄位中,輸入「自訂變數,其中包含將用來作為建立「OCM 資產儲存庫記錄管理」整合之「集合」位置的「OCM 基本儲存庫 ID」。
- 在「限制條件」區段中,取消選取可更新。
- 在固定值欄位中,輸入上方儲存的 OCM 基本資產儲存庫 ID 值 (例如 12424F28875F405FB2144A6FD4DD9FC)。
- 按一下儲存並關閉。
擴充業務物件
您可以使用混搭 (例如上面建立的物件) 來擴充業務物件,以在業務物件 UI 中顯示外部應用程式 (例如 OCM)。
- 依序從左側導覽功能表中依序選擇物件、標準物件、服務要求及頁面。
- 在「服務要求:頁面」頁面的「詳細資料頁面版面配置」區段中,按一下複製詳細資料頁面版面配置圖示。
注意:
如果自訂頁面已經建立,則該頁面可用於「OCM 資產整合」,而不是建立新的頁面,並可略過步驟 3。 - 在「複製版面配置」對話方塊中,完成下列欄位:
- 在新版面配置名稱欄位中,將名稱指定為 OCMEmbeddedUIIntegration 。
- 在來源版面配置欄位中,從下拉式功能表中選取標準版面配置。
- 按一下儲存並編輯。
- 在「詳細資料版面配置」頁面中,選取「子頁標區域」區段左側導覽功能表底部的新增圖示,以新增 OCM 內嵌 UI。
- 選取混搭內容選項。按一下下一步。
- 在下一頁,選取先前建立的 OCMEmbeddedAssetsUIMashup 選項,然後按一下插入。
- 在下一頁,完成下列欄位:
- 在顯示標籤欄位中,輸入資產。
- 若要變更服務要求 UI 中顯示的預設圖示作為頁籤,請按一下顯示圖示。變更圖示
- 在編輯指令碼欄位中,貼上下列指令碼:
println("Service Request Assets Tab Selected: " + SrNumber) // Get the current user security context def secCtx = adf.context.getSecurityContext() // Check to see if the OCM user has been shared to this Repository Collection // NOTE: The user must already be manually shared as at least a contributor to the Base Repository either directly or indirectly through a group for this integration to work boolean isCollectionShared = adf.util.OCMIsRepositoryCollectionSharedAsContributorFunction(OCMBaseRepositoryId_c, OCMCollectionId_c, secCtx.getUserName()) if (!isCollectionShared) { // If not then share the current user as a Contributor to the OCM Collection associated to this item adf.util.OCMShareCollectionFunction(OCMCollectionId_c, secCtx.getUserName(), "contributor") } println("Loading OCM Embedded Assets UI") return '?options={"assetsView":{"select":"single","layout":"grid","sort":"relevance","header":{"add":{"upload":true,"documents":true},"collections":true},"filter":{"bar":{"capsules":false},"repositories":["' + OCMBaseRepositoryId_c + '"],"collections":["' + OCMCollectionId_c + '"]},"filterValue":{"repositoryId":"' + OCMBaseRepositoryId_c + '","collectionId":"' + OCMCollectionId_c + '","includeChildCategories":false},"sidebar":{"categories":true,"conversation":true,"properties":true},"actions":{"open":true,"download":true,"uploadNewVersion":true,"delete":true},"card":{"status":false}},"assetViewer":{"header":{"annotate":true,"fullScreen":true,"close":true},"actions":{"download":true,"uploadNewVersion":true,"makeCurrent":true},"sidebar":{"categories":true,"conversation":true,"properties":true,"renditions":true}},"dialogs":{"addToRepository":{"sidebar":{"categories":true},"default":{"collections":["' + OCMCollectionId_c + '"]}}}}'
注意:
此指令碼會自動將提供者角色指派給存取特定資產儲存庫集合的每個使用者。這可能會進一步調整,例如,將服務要求擁有者授予經理角色,同時將提供者角色提供給其他使用者。 - 按一下下一步 (Next) 按鈕。
- 按一下儲存並關閉。
新增事件觸發程式
事件觸發程式會檢查事件,而當該事件發生時,它會執行與觸發程式相關聯的程式碼。
OCMCreateCollectionTrigger
若要新增伺服器指令碼物件觸發器,以在建立服務要求時建立相關的 OCM 資產儲存庫集合:
- 從左側導覽窗格依序選擇物件、標準物件、服務要求及伺服器指令碼。
- 在「伺服器指令碼服務要求」頁面上,選取觸發器頁籤。
- 在「物件觸發程式」區段下,按一下新增觸發程式。
- 在「建立物件觸發器」頁面上,完成下列欄位:
- 從觸發程式下拉式功能表,選取插入資料庫之前。
- 在觸發程式名稱欄位中,將觸發程式名稱指定為 OCMCreateCollectionTrigger 。
- 在描述欄位中,輸入「建立與目前建立之 ServiceRequest 關聯的 OCM 資產儲存區域集合」。
- 在編輯指令碼欄位中,貼上下列指令碼:
println("ServiceRequest.BeforeInsert(OCMCreateCollectionTrigger): " + SrNumber); // Create a new Collection within the specified Asset Repository Id based off the item SrNumber def OCMCollectionId = adf.util.OCMCreateRepositoryCollectionFunction(OCMBaseRepositoryId_c, SrNumber); setAttribute("OCMCollectionId_c", OCMCollectionId);
- 按一下儲存並關閉。
OCMCopyDocumentsToCollectionTrigger
若要在新的「建立物件觸發程式」頁面中新增伺服器指令碼物件觸發程式,以在服務要求解決時,將相關 OCM 資料夾及其子資料夾中的文件複製到 OCM 儲存庫集合,請完成下列欄位:
注意:
只有在 Oracle Sales and Service 業務物件具有解決選項且已設定 OCM 文件整合時,才需要此觸發。請參閱 Learn About How to Extend Oracle Sales and Service Business Objects with Document Collaboration,瞭解 Document Integration 的詳細資訊。- 從觸發程式下拉式功能表,選取在資料庫更新前。
- 在觸發程式名稱欄位中,將觸發程式名稱指定為 OCMCopyDocumentsToCollectionTrigger 。
- 在描述欄位中,輸入「當標示為已解決時」,將相關「OCM 資料夾」及其下階資料夾中的文件複製到相關「記錄管理集合」。
- 在編輯指令碼欄位中,貼上下列指令碼:
// If the status has been changed then copy all the associated documents to the associated repository collection if (isAttributeChanged('StatusCd')) { println("ServiceRequest.BeforeUpdate(OCMCopyDocumentsToCollectionTrigger): " + SrNumber + ":" + StatusCd + "(" + OCMFolderId_c + ":" + OCMCollectionId_c + ")") if (OCMFolderId_c == null) { println("WARNING: Associated OCM Folder for this Service Request (" + SrNumber + ") does not exist.") return false } if (OCMCollectionId_c == null) { println("WARNING: Unable to copy OCM Documents as there is no associated OCM Collection for this Service Request(" + SrNumber + ").") return false } // Get the Documents from the associated OCM Folder that need to be copied to the Collection def documents = (java.util.List)adf.util.OCMGetDocumentsByFolderIdFunction(OCMFolderId_c) if (documents.size() > 0) { // Copy the documents adf.util.OCMCopyDocumentsToRepositoryCollectionFunction(OCMBaseRepositoryId_c, OCMCollectionId_c, documents) } return true }
- 按一下儲存並關閉。