Refresh Service portal page on UI action

manibaig
Mega Guru

Is there a way to refresh service portal page (form) when user clicks on any UI action (we have 4 custom UI actions on the form). Thanks for your help

1 ACCEPTED SOLUTION

johansec
Tera Guru

If you are using the 'form' widget the form itself should update by itself when the ui action is complete. You can however preform aditional actions by cloning this widget.

 

If you clone the form widget, there is an event listener for when the ui action is complete in the client script.\

$scope.$on("spModel.uiActionComplete", function(evt, response) {
var sysID = (response.isInsert) ? response.sys_id : $scope.data.sys_id;
loadForm($scope.data.table, sysID).then(constructResponseHandler(response));
});

You can add code here to do whatever you need to do.

 

For example

 

  • You could broadcast a rootscope event that other widgets on the page can listen to to update themselves
  • You could navigate to other pages or itself
  • You attempt to refresh scope 

just a couple suggestions to help you get started. 

View solution in original post

2 REPLIES 2

johansec
Tera Guru

If you are using the 'form' widget the form itself should update by itself when the ui action is complete. You can however preform aditional actions by cloning this widget.

 

If you clone the form widget, there is an event listener for when the ui action is complete in the client script.\

$scope.$on("spModel.uiActionComplete", function(evt, response) {
var sysID = (response.isInsert) ? response.sys_id : $scope.data.sys_id;
loadForm($scope.data.table, sysID).then(constructResponseHandler(response));
});

You can add code here to do whatever you need to do.

 

For example

 

  • You could broadcast a rootscope event that other widgets on the page can listen to to update themselves
  • You could navigate to other pages or itself
  • You attempt to refresh scope 

just a couple suggestions to help you get started. 

i tried this and it works except when you click on "Save" button, it displays a pop up to stay on the page or leave.

<button ng-click="triggerUIAction(action)" ng-repeat="action in getUIActions('button')" class="btn btn-primary action-btn pull-right btn-green" onclick="location.reload()">{{action.name}}</button>