配置特定业务对象集成
在此最后一节中,您将执行在特定 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 )。
- 单击保存和关闭。
扩展业务对象
可以使用 Mashup(如上面创建的对象)扩展业务对象,以在业务对象 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 + '"]}}}}'
注:
此脚本自动将贡献者角色分配给访问特定资产存储库集合的每个用户。这可能会进一步细化,例如,在向其他用户授予贡献者角色的同时授予服务请求所有者经理角色。 - 单击下一步按钮。
- 单击保存和关闭。
添加事件触发器
事件触发器检查是否存在事件,并在发生事件时,运行与触发器关联的代码。
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 文档集成时,才需要此触发器。有关文档集成的更多信息,请参阅了解如何使用文档协作扩展 Oracle Sales and Service Business Objects。- 从触发器下拉菜单中,选择在数据库中更新之前。
- 在触发器名称字段中,将触发器名称指定为 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 }
- 单击保存和关闭。