Question

Hide agent name from portal ticket list snippet

  • 11 August 2021
  • 10 replies
  • 148 views

Badge +1

I was able to hide the agent name from the ticket details with;

jQuery('#ticket-field-agent').hide();

And some other fields like this;

  var SupportForm = ['helpdesk_ticket_priority']
SupportForm.map(function(field_id){
jQuery('#'+field_id).parents('.controls ').remove();
})

However the agent name is still showing to our customers in the ticket list view on the portal.

{% snippet ticket_list %}

 

The agent name doesn’t have a field id or it’s own div here, I could hide the whole help-text line but that would also remove the created by and created date information from the list view.

I need to only hide the agent name

How can I achieve this?


10 replies

Userlevel 5
Badge +8

Hello @Jaapbg,

 

To hide the agent name from the ticket list view in the customer portal, you can add the below code snippet under Admin > Portals > Customize portal > Layouts and pages > Portal pages > Ticket list. 

<script>
jQuery(document).ready(function(){
var a = document.getElementsByClassName("emphasize");
var length = document.getElementsByClassName("emphasize").length;
for ( var i=0; i<=length; i++)
{
jQuery(a[i].nextElementSibling).remove();
jQuery(a[i].nextSibling).remove();
}
});
</script>

 

Cheers,

Freshworks Community Team

Badge +1

Thank you very much Hemanth Ramya,

This helped me out. Your script removed the “on” and the date behind.

And with adding +1 it removed the date on tickets that have no agent assigned.

I changed the script as follow and this seems to remove the agent label and agent name;

<script>
jQuery(document).ready(function(){
var a = document.getElementsByClassName("emphasize");
var length = document.getElementsByClassName("emphasize").length;

for ( var i=0; i<=length; i++)
{
let str = a[i].nextSibling.data;
if (str.includes('Agent:'))
{
jQuery(a[i].nextElementSibling).remove();
jQuery(a[i].nextSibling).remove();
}
}
});
</script>

However adding this script breaks the page when changing the ticket filter e.g. from Open and pending to all tickets, than the CSS doesn’t get loaded anymore...

Userlevel 5
Badge +8

Perfect, thank you for sharing the accurate code snippet with us, @Jaapbg! :)

Feel free to drop a note here for any further queries and we would be happy to help! 

 

Cheers,

Freshworks Community Team

Badge +1

Hi, updated my response, didn’t see you already reacted. Should better have added a new reply. Getting used to the flow of this forum, sorry for that.

Hope you might have a solution for this script not responding well on filter changes.

The only ‘error’ I see is Uncaught ReferenceError: jQuery is not defined

Without the script this error is not shown, but not sure if this is actually related to the page not showing correctly after changing the filter.

Badge +1

This update prevents the error and also solves the issue of the page breaking, however I do notice that changing the filter will again show the agents name until the page gets reloaded. So still work in progress :-) 

  <script type='text/javascript'>
var a = document.getElementsByClassName("emphasize");
var length = document.getElementsByClassName("emphasize").length;
for ( var i=0; i<=length; i++)
{
if (typeof a[i] !== "undefined")
{
let str = a[i].nextSibling.data;
if (str.includes('Agent:'))
{
jQuery(a[i].nextElementSibling).remove();
jQuery(a[i].nextSibling).remove();
}
}
}
</script>

 

Userlevel 5
Badge +8

No worries, @Jaapbg. :)

Let us know in case you need any further help and we would be more than glad to assist! 

 

Cheers,

Freshworks Community Team 

Badge +1

Well if there is anyone that has an idea how we can fix the agent name showing again after a filter change on the portal page that would be great.

Userlevel 5
Badge +8

It’s unfortunate that the code snippet is not working as expected, @Jaapbg.

Can you please confirm if you are using the latest code shared but face issues with the customization? It would be great if you can share a video grab of the issue for better understanding. You can make use of Chrome extensions like Vidyard to record your screen.

 

Thank you,

Freshworks Community Team

Badge +1

Hi, I have a video, but we cannot attach video’s here. I uploaded it to my youtube;

 

Badge +1

Hi, I removed the video since it is showing names of our agents. Hope you had a chance to review it. The video itself doesn’t bring much extra to table, it’s simple, if you change a view/filter than all the hidden field become visible again. (Also if you disable javascript in your browser all hidden info becomes visible again) So still need a good solution to hide agent names. 

Reply