Hi,
I want to hide tickets for my customers in the portal based on a date. Every ticket which is created before 1 february 2019 must be hidden for the customers.
I found a topic about making tickets private. It isn't ideal for me, so my question is, could I edit the (red) code so it will hide tickets based on date:
Hello Klaus,
Let me split the setup into three sections : Field creation, Webhook setup, Portal customisation
1. Field creation:
You can create a new custom checkbox field named "Private ticket" under Admin -> Ticket fields section.
Now, the expectation is that when the agents select this field, the ticket would remain private ie. accessible only by the agents
2.Webhook setup:
To achieve this, please navigate to Admin -> Observer rule and setup a rule similar to the one described below :
When any of these events occur -> Private ticket is Checked
And the events are performed by -> Agents
Actions -> Trigger Webhook
You'd have to make a PUT request call to update the ticket subject -> You can refer to the API documentation here. You can construct the params in a way that the subject is updated with the word #private.
"subject":"{{ticket.subject}} #private"
3.Portal customisation:
Now that we have setup the field and the webhook rule to update the ticket subject, we need to hide these tickets from showing up on the portal. You can achieve this only if you're on the Estate or Forest plan.
Navigate to Admin --> Portals --> Customize portal --> Paste the code in ticket list view page
<script>
jQuery(document).ready(function(){
function hide_private(){
jQuery(".c-row.c-ticket-row:contains('#private')").hide();
}
setInterval(hide_private,200);
});
</script>
Navigate to ticket details page on the portal pages and paste the below script:
<script type="text/javascript">
jQuery(document).ready(function(){
if( jQuery('#helpdesk_ticket_custom_field_testing_checkbox_396430').prop("checked")){
jQuery(".c-wrapper").hide();
}
});
</script>
Note : Replace the highlighted text with the custom field created on the helpdesk
Cheers!