Get real time updates in ServicePortal widget 'Data table' when data is updated in the backend table

Hardik Panchal
Mega Guru

Hello All,

I have a widget where it is displaying cases.

What I want is that whenever a case is updated from platform/backend, the update should be reflected in the list.

I'm using spUtil.recordWatch and it is giving the updates in console, but I'm not sure how to reflect those updates in the portal widget list.

Below is the details:

HTML:

 <tbody>
          <tr ng-repeat="item in data.list track by item.sys_id">
            <td role="{{$first ? 'rowheader' : 'cell'}}" class="pointer sp-list-cell" ng-class="{selected: item.selected}" ng-click="go(item.targetTable, item)" ng-repeat="field in ::data.fields_array" data-field="{{::field}}" data-th="{{::data.column_labels[field]}}"><a href="javascript&colon;void(0)" ng-if="$first" aria-label="${Open record}: {{::item[field].display_value}}">{{::item[field].display_value | limitTo : item[field].limit}}{{::item[field].display_value.length > item[field].limit ? '...' : ''}}</a><span ng-if="!$first">{{::item[field].display_value | limitTo : item[field].limit}}{{::item[field].display_value.length > item[field].limit ? '...' : ''}}</span>
            </td>
          </tr>
        </tbody>

 

Client Controller:

	spUtil.recordWatch($scope, 'sn_customerservice_case', "active=true");
	c.update = function update() {
			c.server.update();
	}

 

HardikPanchal_0-1706188089994.png

As you can see in the above screenshot, I'm getting the updated short description in the console, but same is not updating in the widget list.

 

Please Help.

 

Thanks.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Hardik Panchal ,

 

Try something like this, this will get latest data from server and update the client data to reflect the real time changes.

spUtil.recordWatch($scope, 'sn_customerservice_case', "active=true", function(name) {
	$scope.server.get().then(function(response) {
		c.data = response.data; // map client data to the updated server data
        });
});

 

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @Hardik Panchal ,

 

Try something like this, this will get latest data from server and update the client data to reflect the real time changes.

spUtil.recordWatch($scope, 'sn_customerservice_case', "active=true", function(name) {
	$scope.server.get().then(function(response) {
		c.data = response.data; // map client data to the updated server data
        });
});

 

Thank you for answer. it help me to fix a little problem in my widget.