Skip to main content
Matrix42 Self-Service Help Center

HOW-TO: Use Custom Controller for Action Implementation

HOW-TO: Use Custom Controller for Action Implementation

For some cases when no generic Action Implementation Type does not allow to implement an intricate requirement, the "Custom Controller" can be used. 
The example explains how to implement and configure Custom Controller which redirects the UUX page to a specified URL.

See more on Understanding Controllers and UUX Front-end Workspaces pages.

1. Create a new UUX Front-end Workspace

2. Create a new AngularJs Controller.

(function() {
   "use strict";                
    angular.module("Imago.ActionRedirector")              
        .controller("Imago.ActionRedirector.redirectToUrl", ["mx.shell.Config", "$httpParamSerializer", function(e, t) {
            this.execute = function(conf, para) { 
                    var r = function(e) {
                        for (var t = {}, conf = e.split("&"), para = 0; para < conf.length; para++)  {
                            var r = conf[para].split("="),o = r[0],a = decodeURIComponent(r[1]);
                            t.hasOwnProperty(o) ? Array.isArray(t[o]) ? t[o].push(a) : t[o] = [t[o], a] : t[o] = a
                        }
                        return t;
                    }(para.controllerParams);
                    window.location.href = r.RedirectUrl;
            }
      }])
})(window) 

3. Configure Action to use the controller.
Action_CusomController.png

  • Was this article helpful?