PolicyCenter 10.2桌面菜单添加外部链接可行性及报错求助
PolicyCenter 10.2 桌面菜单添加外部链接(新窗口打开)问题解决
需求可行性
该需求完全可行,PolicyCenter支持通过ExitPoint配合Forward配置,实现桌面菜单点击打开外部链接并在新浏览器窗口展示。
现有代码的问题
- 菜单项标题为空:
<LocationRef>未配置title属性,且原配置中desc的双重转义导致框架无法识别标题文本
- 点击后崩溃报错
ExitPoint.getTitle() Operation not supported:- Forward的
action直接调用ExitPoint的push方法不符合规范,PolicyCenter的ExitPoint不支持通过push直接触发跳转 - 链接地址拼写错误:
https:google.coml应为https://google.com
- Forward的
修正后的配置方案
1. 桌面菜单配置(Desktop.pcf)
添加title属性明确菜单项名称,修正图标转义问题:
<LocationRef icon="queues" iconType="svgFileName" location="MyForward()" title="打开外部网站"/>
2. Forward配置(MyForward.pcf)
调整action为调用ExitPoint的invoke方法,修正desc转义:
<?xml version="1.0"?> <PCF xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../pcf.xsd"> <Forward action="MyExternalLinkOpenPortal_Acc.invoke()" allowGoOrPush="false" canVisit="true" desc="打开外部网站" id="MyForward"> <LocationEntryPoint signature="MyForward()"/> </Forward> </PCF>
3. ExitPoint实现(Groovy示例)
ExitPoint需要返回框架可识别的跳转指令,指定外部URL和新窗口打开:
class MyExternalLinkOpenPortal_Acc extends com.guidewire.pc.exitpoint.ExitPoint { @Override Object invoke(Map params) { return [ "type": "externalUrl", "url": "https://google.com", "target": "_blank" ] } }
核心注意事项
- ExitPoint的类名必须和配置中的
action里的ID完全一致,确保框架能正确加载 - 外部链接必须是完整的HTTP/HTTPS格式,避免拼写错误
allowGoOrPush="false"保持不变,因为不需要在PolicyCenter内部路由页面
内容的提问来源于stack exchange,提问作者ra74
相关产品推荐
相关产品推荐

