issues with spUtil.recordwatch

davilu
Mega Sage

I'm trying to use spUtil.recordWatch to update a widget.   My client script looks like this:

function($scope, $sce, spUtil, $timeout, $window, spModal, $location, spHRService, $rootScope, nowServer, $http, $uibModal, $mdDialog) {

/* widget controller */

var c = this;

c.server.get({

action: 'retrieve_data'

}).then(function(response) {

c.data.loading = false;

$scope.active_tasks = [];

$scope.active_workflow = '';

//Get link data

c.stage = response.data.stage;

c.currentOrder = response.data.currentOrder;

$scope.tasksDiv = false;

});

spUtil.recordWatch($scope, 'my_Tasks', "", function(name,data) {

spUtil.update($scope);

});

My recordWatch code above does nothing in terms of updating the widget, is there something I'm doing wrong or missing?

6 REPLIES 6

Jace Benson
Mega Sage

So is the table really "my_Tasks"?



Seems like it should be u_my_tasks, unless you made it in scope, but then it would be x_1111_my_tasks


spUtil - Client


hi Jace, the table name is in our own scope so it's actually x_dnf_task, but i just put my_Tasks as an example.   In my code, I have the correct table name in there and it still doesn't work.   Any suggestions?


I think all you need is this. spUtil.update($scope); not required



spUtil.recordWatch($scope,'x_dnf_task','');



Please mark this response as correct or helpful if it assisted you with your question.

VaranAwesomenow
Mega Sage

Dear David,



Can you try without the callback and see if it works, also as Jace mentioned pls check the table name once and see if it is correct.


spUtil.recordWatch($scope, 'my_Tasks', '');



below is a sample client script that I tried and it works fine.



function(spUtil, $scope) {


  /* widget controller */


  var c = this;


spUtil.recordWatch($scope, 'incident', '');


}



Thanks


Anil