Service Portal Widget won't refresh

jamesmcwhinney
Giga Guru

I am trying to get my widget to refresh when it hears an event.

I have confirmed that the widget hears the event and processes the input, however the HTML doesnt refresh.

Would anyone be able to help me understand why?

here is the html:

<div ng-if="data.showapprovals">
<div class="panel panel-{{::options.color}} b">
  <div class="panel-body">
    <div ng-if="data.approvals.length == 0">
      ${There are no approvals associated with this request yet}
      !{{::data.jamestest}}!
    </div>
  </div>
</div>

 

here is the client script:

function ($scope, spUtil) {
  
  if ($scope.options.portal == true || $scope.options.portal == 'true') {
    $scope.contentColClass = "col-xs-12";
		$scope.options.portal = true;
	} else {
		$scope.options.portal = false;
		$scope.contentColClass = "col-sm-9";
	}

  $scope.data.op = "";
  //spUtil.recordWatch($scope, "sysapproval_approver", "state=requested^approverIN" + $scope.data.myApprovals);
	
	//2018-03-23 James Mcwhinney
	//Refresh when the event is triggered
	$scope.$on('eFormUpdated', function (event, sys_id) {
		$scope.data.sys_id = sys_id;
		$scope.data.jamestest = "hello world!";
		$scope.server.update();
	});

  function get() {
    spUtil.update($scope);
  }

}

 

And here is the server script:

data.jamestest = 'defaultvalue';
if(input){
	data.jamestest = input.jamestest;
	gs.info('recieved test:' + input.jamestest + ':' + data.jamestest);
}



I can see in the log that it receives "hello world", but I dont see it show up in my widget.

 

Thanks!

- James

 

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

Did you try using record watch?

spUtil.recordWatch($scope, "sysapproval_approver", "state=requested");


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

jamesmcwhinney
Giga Guru

It seems to be working now. Im not sure why it wasnt working before.. I dont think I changed anything significant.

Did record watch work or the the $scope.on event?


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

No, Im not sure what fixed it.  maybe it was a caching issue.