PowerApps 使用Xrm.Navigation.navigateTo无法打开CustomPage的问题
Xrm.Navigation.navigateTo打开CustomPage的方式有很多,官方介绍在此
代码也很简单,示例如下
var pageInput = {pageType: "custom",name: "xx_cosignature_a64d2" // Custom Page Schema Name
};var navigationOptions = {target: 2, // 2 = 弹窗 (Dialog)width: 600,height:400,position: 1, // 中间title: "会签弹窗"
};Xrm.Navigation.navigateTo(pageInput, navigationOptions).then(function(returnData) {// returnData 是 Custom Page 通过 Close() 返回的值if (returnData) {console.log("返回数据:", returnData);}}).catch(function(error) {console.error("打开 Custom Page 失败:", error.message);Xrm.Utility.alertDialog("打开 Custom Page 失败: " + error.message);});
但是当你点击按钮去调用的时候,页面就是不弹出来,debug确实执行了按钮的事件也进断点了,加了alert也能弹出,问了AI为什么,AI只是在不停的让你调整代码
最后还得是狗狗,需要把CustomPage添加到你的mda APP中
最后成功打开了