JS 中的 getDirection() 用于确定 Dynamics 365 中 BPF 的方向
getDirection() in JS to determine the direction in BPF in Dynamics 365
我在机会实体的保存上编写了以下代码:
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();
...
});
}
我在机会实体的保存上编写了以下代码:
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();
...
});
}