Hi Jared.
Where is the code? you didnt upload it!
Thanks.
Try
<div id="redirect_to_ticket_list_page"></div>
<script type="text/javascript">
jQuery('#redirect_to_ticket_list_page').closest('.widget').removeClass('widget');
jQuery(document).on('ticket_fields_updated', function(ev, data) {
if (data.hasOwnProperty('helpdesk_ticket[status]')) {
if (data['helpdesk_ticket[status]']['value'] == 2 || data['helpdesk_ticket[status]']['value'] == 3 || data['helpdesk_ticket[status]']['value'] == 4 || data['helpdesk_ticket[status]']['value'] == 5) {
document.location.href = "/helpdesk/tickets"
}
}
});
</script>
<div id="redirect_to_ticket_list_page"></div>
<script type="text/javascript">
jQuery('#redirect_to_ticket_list_page').closest('.widget').removeClass('widget');
jQuery(document).on('ticket_fields_updated', function(ev, data) {
if(data.hasOwnProperty('helpdesk_tickettstatus]')){
document.location.href = "/helpdesk/tickets"
}
});
</script>
I uploaded it but apparently it wasn't cleared by Freshdesk.
The code I just added will take you back to the ticket list regardless of the status you changed the ticket to. The code that Thanos posted is incorrect, since that only does it for tickets that are closed. Mine works regardless of status.
Actually, it is not incorrect. It redirects when the status has changed to 2 ( open ), 3 ( pending ), 4 ( solved ) or 5 ( closed ). It will not work when the status changes to a custom status ( i.e. > 5 ) while your app will do.
As luck would have it, my agents just discovered an issue with this concept:
Suppose you have created a custom field that is
Required when submitting the form or
Required when closing the ticket, compose your reply and click [ Send and set as ... ].
Since the required field is not filled, the reply is not sent, though the status of the ticket is changed. Instead, you get a warning for the field you need to take care of. If you fill that custom field and click [ Update ] you are now redirected back to the tickets view WITHOUT the reply having been sent.
You are correct in that it will not send the reply if a required field has not been filled out.
It hasn't been a problem for us since our agents update the ticket properties and information first and go back up to their ticket reply. Only at that point do they Send + Update instead of using the black "Update" button on the right hand side.
Either way, it would be preferable to change the logic so the black "Update" button also sends the reply that is already populated instead of having to scroll up.
An improvement that, mostly, does not redirect when a reply, note or forward is open:
<div id="redirect_to_ticket_list_page"></div>
<script type="text/javascript">
jQuery('#redirect_to_ticket_list_page').closest('.widget').removeClass('widget');
jQuery(document).on('ticket_fields_updated', function(ev, data) {
if (data.hasOwnProperty('helpdesk_ticket[status]')) {
if ((jQuery('#HelpdeskReply').is(":hidden")) && (jQuery('.cnt-note').is(":hidden")) && (jQuery('.cnt-fwd').is(":hidden"))) {
document.location.href = "/helpdesk/tickets"
}
}
});
</script>
Awesome, Thanos- that makes the original concept even better.
I've tried it out and it works great. Thank you!
Thanos Assias how did you managed to get the function: 'ticket_fields_updated'. Can you tell me? please. THank you.
I want to publish my custom app to freshdesk app gallary not in custom app gallary,
but i am getting error like "Please correct the following errorsUpload a valid Package (.zip) File"
If i am create ticket using javascript but not working....
if anyone know ,give favourable answer !!!
I am experiencing the same problem of "Please correct the following errors: Upload a valid Package (.zip) File" while uploading a sample "My first app" as a custom app.
- "frsh validate" runs with no errors
- "frsh pack" produces the project .zip package
- error while "Publishing" the sample app as a custom app
Would appreciate any help concerning this matter.
Thank you.
During frsh pack command there is a warning:
(node:11912) DeprecationWarning: Archiver.bulk() deprecated since 0.21.0