Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Ribbon workbench 2016 button EnableRule\CustomRule

$
0
0

Hi all

I want to have EnableRule\CustomRule which triggers JS function returning true/false value to this rule.

Button:

Command

 

Enable Rule

JS:

 

/// <reference path="../../generatedCode/incident.Information.js" />

/// <reference path="../../lib/XrmPage-vsdoc.js" />

/// <reference path="library.js" />

/// <reference path="../../../lib/process.js" />

/// <reference path="enums.js" />

/// <reference path="../../../sdk/webapi.js" />

 

var csp = window.csp || {};

 

csp.incident = (function (incident) {

    "use strict";

 

    var viewModel = new csp.incident.Form(Xrm);

 

    incident.RibbonController = function () {

 

        /* jshint ignore:start */

        function ribbonController() {

        }

        /* jshint ignore:end */

 

        // Sample

        this.openCustomWindow = function () {

            return viewModel.TaskId.getValue();

        };

 

        this.markConfidentialBtn = function () {

            debugger;

            viewModel.Confidential.setValue(1);

            alert("Hello");

        };

        this.unmarkConfidentialBtn = function () {

            debugger;

            viewModel.Confidential.setValue(0);

            alert("Hello");

        };

 

        this.enableMarkConfidentialBtn = function () {

            debugger;

            alert("enableMarkConfidentialBtn");

            return true;

/*            if (viewModel.Confidential === true) {

                return false;

            }

            else {

                return true;

            }*/

        };

        this.enableUnMarkConfidentialBtn = function () {

            debugger;

            alert("enableUnMarkConfidentialBtn");

            return true;

/*            if (viewModel.Confidential === false) {

                return false;

            }

            else {

                return true;

            }*/

        };

    };

 

    return incident;

 

}(csp.incident || {}));

 

/// <reference path="ribbonController.js" />

/// <reference path="../../../generatedCode/incident.Information.js" />

 

var csp = window.csp || {};

 

csp.incident = (function (incident) {

    "use strict";

 

    var controller = new csp.incident.RibbonController();

 

    incident.RibbonContract = {

 

        // Sample

        openCustomWindow: function () {

            controller.openCustomWindow();

        },

        markConfidentialBtn: function () {

            debugger;

            controller.markConfidentialBtn();

        },

        unmarkConfidentialBtn: function () {

            debugger;

            controller.unmarkConfidentialBtn();

        },

        enableMarkConfidentialBtn: function () {

            debugger;

            controller.enableMarkConfidentialBtn();

        },

        enableUnMarkConfidentialBtn: function () {

            debugger;

            controller.enableUnMarkConfidentialBtn();

        },

    };

 

    return incident;

 

}(csp.incident || {}));

 

 

It seems that JS function isn’t called by rule. Button is hide, and alert message doesn’t display.

Thanks in advance for helping

Kind regards

Petr


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>