到达 Dynamics CRM 2015 流程中的阶段步骤时在功能区中显示按钮

Display a button in ribbon when arriving to a step of a stage in a process flow in Dynamics CRM 2015

我需要您的帮助:当到达 Dynamics CRM 2015 中的流程阶段的某个步骤时,如何在功能区中显示按钮?

提前致谢!!

您可以使用以下代码获取流程阶段:

Xrm.Page.getAttribute('stageid').getValue()

和以下代码获取功能区按钮:

var btnRunWorklfow=top.document.getElementById("account|NoRelationship|Form|Mscrm.Form.account.RunWorkflow-Large");

要隐藏按钮,您可以在表单或控件事件之一中使用类似于此的javascript:

var stageID = Xrm.Page.getAttribute("stageid").getValue();
if (stageID == 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx') {

    var btnRunWorklfow=top.document.getElementById("account|NoRelationship|Form|Mscrm.Form.account.RunWorkflow-Large");
    btnRunWorklfow.style.display='none';

}

您还可以使用 codeplex 中提供的功能区编辑器根据您的javascript禁用按钮。

参考:http://crmvisualribbonedit.codeplex.com/

这也是一个有用的link:Hiding/Showing a Section Based on the Current Stage