在CRM 2011中,我正在開發「案例」頁面上的功能區按鈕,以啓動自定義對話框。到目前爲止,這是行之有效的。使創建和只讀表單中的功能區按鈕不可用
現在我試圖在創建案例和案例已關閉後禁用該按鈕。
在customization.xml,這就是我把我的CommandDefinitions使用RuleID「Mscrm.DisableDeactivateButton」
<CommandDefinitions>
<CommandDefinition Id="Cmd_DialogEscalateCase">
<EnableRules>
<EnableRule Id="Mscrm.DisableDeactivateButton" /> ----> this is the name of the Rule
</EnableRules>
<DisplayRules />
<Actions>
<JavaScriptFunction FunctionName="launchModalDialog" Library="$webresource:new_launchDialog">
<!-- dialogID, typeName, recordId -->
<StringParameter Value="38d3bc89-ac5f-4097-94df-e9b165177777" />
<StringParameter Value="incident" />
<CrmParameter Value="FirstPrimaryItemId" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
然後這是我Mscrm.DisableDeactivateButton」的定義將觸發一個名爲一個JScript webresouce 「DisableDialogButton」:
<EnableRule Id="Mscrm.DisableDeactivateButton">
<CustomRule FunctionName="DisableDialogButton" Library="$webresource:nwp_launchDialog" Default="true" />
</EnableRule>
最後他是我的javascript DisableDialogButton返回false時formType爲1(創建)或3(只讀):
function DisableDialogButton()
{
var formType = Xrm.Page.ui.getFormType();
if (formType = 1 || formType = 3)
{return false;
}
else
{return true;
}
}
但是,此功能仍然無法正常工作。你能指導我在這個方向應該採取什麼方向嗎?
請出示你CustomActions何去何從 – Scorpion