thingsboard-developers

Details

diff --git a/ui/src/app/components/widget/action/widget-action-dialog.tpl.html b/ui/src/app/components/widget/action/widget-action-dialog.tpl.html
index ded4c96..aa0971a 100644
--- a/ui/src/app/components/widget/action/widget-action-dialog.tpl.html
+++ b/ui/src/app/components/widget/action/widget-action-dialog.tpl.html
@@ -120,7 +120,7 @@
                         </div>
                         <tb-js-func ng-if="vm.action.type == vm.types.widgetActionTypes.custom.value"
                                     ng-model="vm.action.customFunction"
-                                    function-args="{{ ['$event', 'widgetContext', 'entityId'] }}"
+                                    function-args="{{ ['$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams'] }}"
                                     validation-args="{{ [] }}">
                         </tb-js-func>
                     </fieldset>
diff --git a/ui/src/app/components/widget/widget.controller.js b/ui/src/app/components/widget/widget.controller.js
index 7d91aef..a5faada 100644
--- a/ui/src/app/components/widget/widget.controller.js
+++ b/ui/src/app/components/widget/widget.controller.js
@@ -444,7 +444,7 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
         }
     }
 
-    function handleWidgetAction($event, descriptor, entityId, entityName) {
+    function handleWidgetAction($event, descriptor, entityId, entityName, additionalParams) {
         var type = descriptor.type;
         var targetEntityParamName = descriptor.stateEntityParamName;
         var targetEntityId;
@@ -485,8 +485,11 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
                 var customFunction = descriptor.customFunction;
                 if (angular.isDefined(customFunction) && customFunction.length > 0) {
                     try {
-                        var customActionFunction = new Function('$event', 'widgetContext', 'entityId', 'entityName', customFunction);
-                        customActionFunction($event, widgetContext, entityId, entityName);
+                        if (!additionalParams) {
+                            additionalParams = {};
+                        }
+                        var customActionFunction = new Function('$event', 'widgetContext', 'entityId', 'entityName', 'additionalParams', customFunction);
+                        customActionFunction($event, widgetContext, entityId, entityName, additionalParams);
                     } catch (e) {
                         //
                     }
diff --git a/ui/src/app/widget/lib/alarms-table-widget.js b/ui/src/app/widget/lib/alarms-table-widget.js
index 9e96d4d..101c234 100644
--- a/ui/src/app/widget/lib/alarms-table-widget.js
+++ b/ui/src/app/widget/lib/alarms-table-widget.js
@@ -298,7 +298,7 @@ function AlarmsTableWidgetController($element, $scope, $filter, $mdMedia, $mdDia
                 entityId = vm.currentAlarm.originator;
                 entityName = vm.currentAlarm.originatorName;
             }
-            vm.ctx.actionsApi.handleWidgetAction($event, descriptors[0], entityId, entityName);
+            vm.ctx.actionsApi.handleWidgetAction($event, descriptors[0], entityId, entityName, { alarm: vm.currentAlarm });
         }
     }
 
@@ -312,7 +312,7 @@ function AlarmsTableWidgetController($element, $scope, $filter, $mdMedia, $mdDia
             entityId = alarm.originator;
             entityName = alarm.originatorName;
         }
-        vm.ctx.actionsApi.handleWidgetAction($event, actionDescriptor, entityId, entityName);
+        vm.ctx.actionsApi.handleWidgetAction($event, actionDescriptor, entityId, entityName, { alarm: vm.currentAlarm });
     }
 
     function isCurrent(alarm) {