DisplayCustomFieldsOnTicketUpdatePage

From Request Tracker Wiki
Jump to navigation Jump to search

Introduction

As part of implementing a work flow where custom fields must be set before the ticket is closed, I wanted to make the custom fields visible on the status-update page when resolving a ticket so an admin could see they are unset and set them before trying to do a resolve (or during previous updates).

Instructions for 4.0.5

Instead of copying a File to the "local" setup (and dealing with upgrade problems), here is an elegant solution using Callbacks

Create a file called $RT_HOME/local/html/Callbacks/MyCallbacks/Ticket/Update.html/AfterWorked with the following content

<%INIT>
$m->comp("/Ticket/Elements/EditCustomFields", TicketObj => $ARGS{'Ticket'}, AsTable => 1);
return 1;
</%INIT>
<%ARGS>
</%ARGS>

Empty the Mason cache and reload Apache

Instructions for RT 3.8.6.

o cd /opt/rt3 # or your root

o cp share/html/Ticket/Update.html local/html/Ticket/Update.html

o Decide where in the layout you want the custom fields to appear. Add this line at the appropriate place in local/html/Ticket/Update.html.

<& /Ticket/Elements/EditCustomFields, TicketObj => $TicketObj &>

o To display the custom fields without making them interactive, use this line:

<& /Ticket/Elements/ShowCustomFields, Ticket => $TicketObj &>

I made this insertion at line 121, which puts the custom fields just above the text-entry box. If the GnuPG widget is enabled, that will likely appear just after the custom fields.