EditCustomFieldsOnUpdate: Difference between revisions
(→RT 3.8) |
m (6 revisions imported) |
(No difference)
|
Latest revision as of 15:08, 6 April 2016
Introduction
Read below about customizing RT to allow your users to update ticket's custom fields at the same time they reply, comment or resolve.
Two methods presented that are slightly different:
- put editor for ticket's custom fields on Update.html page
- use Jumbo (ModifyAll.html) page for such actions
The latter is quite aggressive, but anyway described below.
Editor on Update.html
RT 4
Use CustomFieldsOnUpdate extension. Not only adds custom fields and process them, but also does validation of input and returns users back if it fails.
RT 3.8
This should work on almost any version of 3.8. When 3.8.8 is released, there are a few extra callbacks in Update.html that you could use to control where in the layout the Custom Fields appear. This solution skips validation.
$ mkdir -p $RTHOME/local/html/Callbacks/My/Ticket/Update.html/
Then add code to a BeforeUpdateType file in the above directory
</table> <& /Ticket/Elements/EditCustomFields, TicketObj => $TicketObj &> <table> <%INIT> my $TicketObj = LoadTicket($id); </%INIT> <%ARGS> $id => undef </%ARGS>
Clear mason cache, restart apache and your Custom Fields should show up.
If previous method can't work you can try another method. Paste this string:
<& Elements/EditCustomFields, TicketObj => $TicketObj, DefaultsFromTopArguments => 0 &>
before
<& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $TicketObj &>
Clear mason cache and restart apache.
Older versions
This page and a few that redirect to this page had solutions for older versions of RT, but info was so unorganized and messy that it was easier to delete it rather then maintain it.
Showing only some custom fields
If you want to have more control over what custom fields are available for editing, you'll want to use the EditCustomFields callback, MassageCustomFields
Showing editor only for particular change
EditCustomFieldAtResolve only allows users to edit one custom field and when status going to be 'resolved'. It's for old RT versions, has some limitations, but may be a starting point for a new customization.
Jumbo-page based solution
If what you want to achieve is the possibility to Reply/Comment with quoted text, edit custom fields and set dates in the same form, you could change the links Reply and Comment in the Ticket History.
Newer versions
It's still can be done with newer RTs, but nobody ported it over.
RT 3.4.2 and 3.6.0pre1
Tested on these versions. Probably works for all 3.4.x and 3.6.x.
1) Copy share/html/Ticket/Elements/ShowHistory to local/html/Ticket/Elements/
2) Edit local/html/Ticket/Elements/ShowHistory and change the line:
$UpdatePath => $RT::WebPath."/Ticket/Update.html"
to:
$UpdatePath => $RT::WebPath."/Ticket/ModifyAll.html"
3) Copy share/html/Ticket/ModifyAll.html to local/html/Ticket/
4) Edit local/html/Ticket/ModifyAll.html and change to whole block:
<select name="UpdateType"> % if ($CanComment) { <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option> % } % if ($CanRespond) { <option value="response"><&|/l&>Reply to requestors</&></option> % } </select>
to:
<select name="UpdateType"> % if ( $ARGS{'Action'} eq "Respond" ) { % if ($CanComment) { <option value="private" ><&|/l&>Comments (Not sent to requestors)</&></option> % } % if ($CanRespond) { <option value="response" SELECTED><&|/l&>Reply to requestors</&></option> % } % } else { % if ($CanComment) { <option value="private" SELECTED><&|/l&>Comments (Not sent to requestors)</&></option> % } % if ($CanRespond) { <option value="response"><&|/l&>Reply to requestors</&></option> % } % } </select>
5) Restart your Apache