簡體   English   中英

如何通過JavaScript更新CRM功能區按鈕的禁用原因

[英]How to Update the Disabled Reason of a CRM Ribbon Button Via Javascript

我有一個帶有多個自定義按鈕的表單,這些按鈕由於多種原因而被啟用/禁用,每個原因都由一個Javascript函數確定,該函數被稱為“自定義功能區啟用規則”的一部分。 作為啟用規則JavaScript的一部分,我想更新懸停文本,原因是該按鈕被禁用:“此記錄缺少Yada Yada Yada”,“您沒有訪問權限”,等等。

當前,默認消息是“您可能尚未選擇與此功能一起使用的項目。如果您沒有使用此功能的權限,請與系統管理員聯系。”

是否可以從啟用規則中對其進行更新? (是的,我知道這將不受支持),如果是,怎么辦?

我猜想我會使用JQuery,但是我對選擇器並不足夠熟悉,無法選擇該div ...

<span 
    class="ms-cui-tooltip" 
    id="new_inquiry|NoRelationship|Form|NEWNEW.Form.itt_inquiry.MainTab.MoveTo.StudentMovement_ToolTip" 
    role="tooltip" 
    aria-hidden="true" 
    style="left: 405px; top: 135px; visibility: hidden; position: absolute; min-width: 210px;" 
    unselectable="on">
    <div class="ms-cui-tooltip-body" unselectable="on">
        <div class="ms-cui-tooltip-glow" unselectable="on">
            <h1 unselectable="on">Movement</h1>
            <div class="ms-cui-tooltip-description" unselectable="on">Movement Description</div>
            <div class="ms-cui-tooltip-clear" unselectable="on"></div>
            <hr unselectable="on">
            <div class="ms-cui-tooltip-footer" unselectable="on">
                <span class=" ms-cui-img-16by16 ms-cui-img-cont-float" style="vertical-align: top;" unselectable="on"></span>
                <div unselectable="on">This button is currently disabled.</div>
            </div>
            <div class="ms-cui-tooltip-description" style="width: 90%;" unselectable="on">
                You may not have selected the item that works with this feature.  If you do not have permissions to use this feature, contact your system administrator.
            </div>
        </div>
    </div>
</span>

您可以使用如下所示的內容:

var btnId = "new_inquiry|NoRelationship|Form|NEWNEW.Form.itt_inquiry.MainTab.MoveTo.StudentMovement_ToolTip";
var btnCls = "ms-cui-tooltip-description"";
var newText = "New button description";
$("#" + btnId + "." + btnCls, window.parent).text(newText);

這將在父(功能區)窗口上查找具有特定ID和類的元素,並更改其文本; 雖然沒有經過測試,但是您可能需要對其進行一些調整。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM