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

Hi Alex,

For some reason this code is hiding Additional comments as well.

Can you please help me understand?

Attaching screenshots of code I added on client side.

Thanks

Monika Bhoyate

Hi Alex,

 

Thank you for the code!

I have cloned the "Ticket Conversations", copied and replaced the code you provided, and replace the widget on page designer (Ticket Forms).

However, the work notes still appear on service portal.

 

How to get it working?

 

Thank you!

 

Best regards,

Leo

Vijay90
Kilo Contributor

Hi Alex,

Did same thing like from line (86-111) replaced the code in client controller but still am able to see the work notes in portal.

Also cloned widget mapped in the page.Kindly please help me on this..

Thanks,

Vijay

Mi Mi
Tera Contributor

Thank you so much, Alex @alxcrlsn. Your code helped me to achieve one of our requirements hiding work notes on the portal.

We also need to hide work notes from users who are not part of the incident assignment group. If you or anyone can assist me how to do it that will be really great.

Community Alums
Not applicable

Hi community,


can any one tell how to hide work notes  on close incident form on service portal in Instanbul?