Invoking a function in the Link Function section from the Client Script in a Widget

Plissken
Tera Expert

Hello,

I have a function in the 'Link Funciton' section of a widget that I would like to call from the Client Script controller.

The Link function is simply a timer function like so:

scope.stopScroll = function () {
  if (angular.isDefined(timer)) {
    $interval.cancel(timer);
  }
}

I have a recordWatch on the Client Script:

spUtil.recordWatch($scope, 'sys_journal_field', 'name=sn_customerservice_case', function (name, data) {
  // would like to call the stopScroll function here
  c.server.refresh();
});

So if a record is updated, the stopScroll() function is called.

Many thanks

Snake!

1 ACCEPTED SOLUTION

Sunil B N
ServiceNow Employee
ServiceNow Employee

Hi,

spUtil.recordWatch($scope, 'sys_journal_field', 'name=sn_customerservice_case', function (name, data) {
 $scope.stopScroll();//this is not working?
 c.server.refresh(); 
});

This way its not working?

View solution in original post

2 REPLIES 2

Sunil B N
ServiceNow Employee
ServiceNow Employee

Hi,

spUtil.recordWatch($scope, 'sys_journal_field', 'name=sn_customerservice_case', function (name, data) {
 $scope.stopScroll();//this is not working?
 c.server.refresh(); 
});

This way its not working?

AAGGHH! I tried this (and many other things) prior to typing out the post because this seemed the right way but it didn't work at the time! Just did it again and it works ha ha.

Great thanks for replying Sunil!