Hide worknote for everyone on Service Portal [Helsinki]

gregooze
Kilo Contributor

Hi community, hope you are well,

I would like to know how we can hide the worknote (incident & request) for everyone on Service Portal (but have to be visible on backend) in Helsinki.

Capture d

First, I tried to configure the activity formatter on the form to disable the visibility of the "worknote". Ok, it's work on serviceportal but we still have to see the worknote on the backend form.

I thought about making different views but it seems that when we modify the activity formatter, it saves it as a system property (e.g.glide.ui.incident_activity.fields), so it is not about view.

Then I saw that we can add in form design two "Activities (filtered)" fields =>Capture d Are they the same? In UI15, when I select the two fields, and that I modify the activity formatter to filter the worknote, one is showing the worknote and the other not.

Capture d and this is hidding on the serviceportal the worknote Capture d, so it seems to look like what I wanted. We certainly had to hide the first activity stream on the form by script but I tried on UI16 (We have to be in UI16), and neither of them displays the worknote.

Finally, I think that we have to hide worknote on serviceportal by changing directly the widget: Ticket conversation

On the server script we have :

Capture d "Journal_fields" is "comments" and "worknotes", how can we differenciate them and only take the additional comments?

Do you have any idea about this? a workaround?

Thank you a lot in advance,

1 ACCEPTED SOLUTION

alxcrlsn
Tera Expert

If you still want to hide the work notes, or if anybody else does, here's a solution. First, I created a new array (line 10). Then, I took the array of journal messages and iterated through it looking for work notes (lines 13-14). Anything that isn't a work note is copied into a new array (line 15). Then, I set this new array as the value of the original array, and moved all future assignments below the new code (lines 20-21). It's a bit clunky, but iterating through the original array with a for loop and removing the work notes didn't work consistently for me. This did the trick.



Steps to reproduce:



  1. Clone the "Ticket Conversations" widget (since ticket conversations are OOB and read only), and place the cloned one on your page.
  2. Replace the mergeStreamEntries() function (lines 86-111) in the client script with the following code:


function mergeStreamEntries() {


      $scope.placeholder = $scope.data.placeholderNoEntries;


      if (!$scope.data.stream || !$scope.data.stream.entries)


              return;




      $scope.placeholder = $scope.data.placeholder;




      var newEntries = [];




      $scope.data.stream.entries.forEach(function(entry) {


              if (entry.element != "work_notes") {


                      newEntries.push(entry);


              }


      });




      $scope.data.stream.entries = newEntries;


      var entries = $scope.data.stream.entries;




      if (!$scope.data.mergedEntries) {


              $scope.data.mergedEntries = $scope.data.stream.entries.slice();




              for (var i = 0; i < entries.length; i++) {


                      existingEntries[entries[i].sys_id] = true;


              }


              return;


      }




      var mergedEntries = $scope.data.mergedEntries;


      for (var i = entries.length - 1; i >= 0; i--) {


              var curEntry = entries[i];


              if (existingEntries[curEntry.sys_id])


                      continue;




              mergedEntries.unshift(curEntry);


              existingEntries[curEntry.sys_id] = true;


      }


}


View solution in original post

25 REPLIES 25

Brad Tilton
ServiceNow Employee
ServiceNow Employee

I'm just wondering the reason for hiding the work notes on the service portal. If you're worries about end users seeing them it should work the same in SP as it does in the standard ui where only users with the itil role see the work notes.


Yes you're right, I already tried yesterday to explain this but apparently it was necessary.
Finally I took more time today to explain this again, and now it is ok.



Thanks a lot for your quick answer,



Best Regards



What if the caller is ITIL? Is there a way to only show work notes based on assignment group or assignment group roles in this scenario? Ideally we would only like the work notes to be dependent on roles from current assignment group.

Mi Mi
Tera Contributor

Hi @Cobee 

We also would have the similar idea as yours. We would like to hide work notes from users both on the portal and in the native view if users are not part of that incident assignment group.

Have you found out the solution for you?