javascript - JS 中的 getDirection() 确定 Dynamics 365 中 BPF 中的方向
问题描述
我在机会实体的保存上编写了以下代码:
function bpf(executionContext)
{
var formContext = executionContext.getFormContext();
formContext.data.process.addOnStageChange(function () {
// debugger;
//alert("JS called");
var stageName = formContext.data.process.getSelectedStage().getName().toString().toLowerCase();
//alert(stageName);
var accountApproved = formContext.getAttribute("new_accountstatusapproved");
var direction = executionContext.getEventArgs().getDirection();
//alert(direction);
if (stageName != "" && stageName === "check status" && accountApproved != null && accountApproved.getValue() != null && accountApproved.getValue() == 0)
{
//debugger;
formContext.data.process.movePrevious();
formContext.ui.setFormNotification("The Account is not Approved.", "WARNING", "1");
}
});
}
基本上,我需要使用以下行获取 BPF 的方向:
var direction = executionContext.getEventArgs().getDirection();
getDirection() 没有按预期工作。该控件将转到ribbon.js 中的其他一些功能,并且需要无限的时间。
我在这里错过了什么?
谢谢
解决方案
executionContext 是对保存事件的引用。您修改 addOnStageChange 回调函数以接收舞台上下文
function bpf(executionContext)
{
var formContext = executionContext.getFormContext();
formContext.data.process.addOnStageChange(function (stageContext) {
var direction = stageContext.getEventArgs().getDirection();
...
});
}
推荐阅读
- laravel - 如何解决 Kreait \ Firebase \ Exception \ ApiException (400) invalid_grant for firebase
- python - Best object oriented python construct to use for particular application
- bash - How to find the average time from log file for a specific pattern matched string
- docker - 使用 docker-compose 在服务器上构建多容器 docker 镜像
- c# - Matching in-world texture to overlay image using mesh UVs
- css - ul li 比浏览器窗口更宽 强制换行进行分页
- typescript - TypeScript:如何编写具有条件返回类型的函数
- angular - ngx admin redirect if user session expire on server side
- sql - 查询任何非空值也设置了标志(位)的位置
- arrays - index(of: not appearing for [[String:Any]]