Skip to main content


Place an extra Edit button to the ticket toolbar ( so you don't have to open the more menu ):



<div id="edit_ticket_toolbar"></div>

<script type="text/javascript">

jQuery('#edit_ticket_toolbar').closest('.widget').removeClass('widget'); // Hide widget from sidebar

jQuery(document).on("ticket_view_loaded", function(event, data) {

var obj_target = jQuery('#watcher_toggle').parent();

jQuery('<li class="ticket-btns"><a class="btn tooltip" id="edit_ticket_btn_toolbar" title="Edit" href="/helpdesk/tickets/{{ticket.id}}/edit">Edit</a></li>').insertBefore(obj_target);

});

</script>




 







Lovely




I am trying a more advanced version these days. There are times when a ticket is not editable ( for example, when the Source is Outbound Email ). The improved version handles such cases more gracefully but I haven't tried it thoroughly. Here it is:
<div id="edit_ticket_toolbar"></div>

<script type="text/javascript">

jQuery('#edit_ticket_toolbar').closest('.widget').removeClass('widget'); // Hide widget from sidebar

jQuery(document).on("sidebar_loaded", function(event, data) {

var obj_target = jQuery('div.ticket-actions div#watcher_toggle').parent();

var extra_err = '';

if (jQuery('div.ticket-actions div#more-btn li.edit').html()) {

jQuery('<li class="ticket-btns"><a class="btn tooltip" id="edit_ticket_btn_toolbar" title="Edit" href="/helpdesk/tickets/{{ticket.id}}/edit">Edit</a></li>').insertBefore(obj_target);

} else {

if (jQuery('ul#TicketPropertiesFields select#helpdesk_ticket_source').val() == '10') {

extra_err = '<br>( Source is ' + jQuery('ul#TicketPropertiesFields select#helpdesk_ticket_source option:selected').html() + ' )';

}

jQuery('<li class="ticket-btns"><div style="color: #f96; margin: 0 7px; font-size: smaller; text-align: right; line-height: 1.2em">Cannot Edit' + extra_err + '</div></li>').insertBefore(obj_target);

}

});

</script>


 



 




And this is an example of what one sees, when the ticket is not editable:









Is there anyway of removing the "SR" or "INC" within the URL as it stops ours working on FreshService (I know this was created for Freshdesk but I would love to implement it)

















Freshservice does also use {{ ticket.id }} but creates the above and not simply this which is how the default edit link works:








Many thanks,
Luke




Luke, can you try this? It should work if the {{ticket.id}} format is as you described. In regards with the rest of the functionality, I do not know if the value for Source = Outbound Email is 10 or if the ticket is not editable then but it shouldn't be difficult to adjust the code.
<div id="edit_ticket_toolbar"></div>

<script type="text/javascript">

jQuery('#edit_ticket_toolbar').closest('.widget').removeClass('widget'); // Hide widget from sidebar

jQuery(document).on("sidebar_loaded", function(event, data) {

var obj_target = jQuery('div.ticket-actions div#watcher_toggle').parent();

var extra_err = '';

var ticket_id = '{{ticket.id}}';

if (ticket_id.indexOf('-') > -1) {

field_arr = ticket_id.split('-');

ticket_id = field_arr[1];

}

if (jQuery('div.ticket-actions div#more-btn li.edit').html()) {

jQuery('<li class="ticket-btns"><a class="btn tooltip" id="edit_ticket_btn_toolbar" title="Edit" href="/helpdesk/tickets/' + ticket_id + '/edit">Edit</a></li>').insertBefore(obj_target);

} else {

if (jQuery('ul#TicketPropertiesFields select#helpdesk_ticket_source').val() == '10') {

extra_err = '<br>( Source is ' + jQuery('ul#TicketPropertiesFields select#helpdesk_ticket_source option:selected').html() + ' )';

}

jQuery('<li class="ticket-btns"><div style="color: #f96; margin: 0 7px; font-size: smaller; text-align: right; line-height: 1.2em">Cannot Edit' + extra_err + '</div></li>').insertBefore(obj_target);

}

});

</script>