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

Pritha1
Mega Expert

Take out the :: in the HTML. That will fix the issue. Use like this {{variableName}}

Brian Rivera
ServiceNow Employee
ServiceNow Employee

Solved the issue for me