[英]How can I work with save and route button Dynamics 365?
I need to validate if some notes exist in Dynamics 365 before saving and assign (route), the problem is that fetch goes async and save goes sync... I know that by now Microsft recommends going async, so what's the viable solution to do?我需要在保存和分配(路由)之前验证 Dynamics 365 中是否存在一些注释,问题是 fetch 会异步,save 会同步……我知道现在 Microsft 建议使用异步,那么可行的解决方案是什么? Save can be canceled and called, but how can I cancel and call the button save and route?可以取消和调用保存,但是如何取消和调用按钮保存和路由? or something similar to do this async?或类似的东西做这个异步?
I have tried a lot of similar things, but it doesn't work.我尝试了很多类似的东西,但它不起作用。
Is there some AddChange to Notes(linked to Entity)?是否有一些 AddChange 到 Notes(链接到实体)?
Typically we will cancel the Save event using preventDefault()
, complete the required steps & reissue the Save like discussed here .通常,我们将使用preventDefault()
取消Save事件,完成所需的步骤并重新发出Save ,如此处讨论的那样。
In your scenario, special Save & Route
button is achieving Save as well as Apply Routing Rule action.在您的场景中,特殊的Save & Route
按钮实现了Save & Route
Apply Routing Rule操作。 There's no save mode for this sequence to use getSaveMode
for intercepting & reissue.此序列没有使用getSaveMode
进行拦截和重新发布的保存模式。 Reference 参考
But you can try a custom Save & Route button using Ribbon workbench and invoke a custom Javascript action to do:但是您可以使用功能区工作台尝试自定义保存和路由按钮并调用自定义 Javascript 操作来执行以下操作:
ApplyRoutingRule
action using webapi Read more使用 webapi 调用ApplyRoutingRule
操作阅读更多Don't forget that Xrm.WebApi
is always Asynchronous, you have to do chain of calls inside success callback or use XMLHttpRequest
for synchronous mode.不要忘记Xrm.WebApi
始终是异步的,您必须在成功回调中执行调用链或使用XMLHttpRequest
进行同步模式。 Read more 阅读更多
Update : I composed this snippet with the help of CRM REST Builder, try it.更新:我在 CRM REST Builder 的帮助下编写了这个片段,试试吧。
var parameters = {};
var target = {};
target.incidentid = "00000000-0000-0000-0000-000000000000";
target["@odata.type"] = "Microsoft.Dynamics.CRM.incident";
parameters.Target = target;
var applyRoutingRuleRequest = {
Target: parameters.Target,
getMetadata: function() {
return {
boundParameter: null,
parameterTypes: {
"Target": {
"typeName": "mscrm.crmbaseentity",
"structuralProperty": 5
}
},
operationType: 0,
operationName: "ApplyRoutingRule"
};
}
};
Xrm.WebApi.online.execute(applyRoutingRuleRequest).then(
function success(result) {
if (result.ok) {
//Success - No Return Data - Do Something
}
},
function(error) {
Xrm.Utility.alertDialog(error.message);
}
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.