OTRS – Adding Templates to OTRS

We’re currently investigating using OTRS, with the ITSM modules, as a possible ticketing system.  In version 3.0, they’ve got the ability to add ticket templates.  Templates are nice in that they allow you to create semi-complete tickets just by choosing a template.  That is one of the features that FrontRange’s ITSM product have in Version 7 that we were really looking forward to having.  Currently, in FRS’s ITSM (version 6) we’re using QuickActions to do basically the same thing.

There is a great Youtube video that describes what to do to get templates working in the default form.   The problem is that the example template code that OTRS has in the AgentTicketPhone.dtl file discussed uses a button to choose the template text.  That’s all well and fine for some browsers, but doesn’t work in all of them, due to using the onclick function.  Seems that Safari and some other browsers just ignore that. Plus, in my opinion, it would be pretty ugly, and reminiscent of a 1990’s webpage, to have a dozen different buttons to click on.  Maybe if they were each a different color and blinked…

Anyway, after some Trial and Error, I was able to get a cleaner method working – in IE, Firefox, Safari, and other browsers.  I replaced the button(s) with a dropdown menu.  This is simply a select tag, with an option representing each template form.  It then uses the onchange function, rather than the onclick function, fire off the appropriate form.  This means that all of the major browsers seem to be all right with it.  I tested it in IE, Firefox, Opera, Safari, and Chrome and they all worked as expected.

What I’ve done is create a custom theme, then copied and altered the AgentTicketPhone.dtl file to add my changes.  This means that during upgrades, my changes won’t be overwritten, since they’re not made in the default file.

Anyway, the way the example is written in the file is:

As you can see, it uses the onclick function and each template would require its own button.

What I’ve done, is add a dropdown via the select tag and its options and used the onchange function:

Things to note are:

1> Make sure to add the id=”some_name” to your select tag, or the GetElementByID() won’t work, since there won’t be an ID to get.

2> The option values are actually the names of each form that I’ve added at the bottom of the page.  That means that there’s a form at the bottom with id=”PassReset” and one with id=”VirusMalware”.   These forms contain the fields and values that you want to use to automagically populate the ticket.  Changing the fields and values is covered in the video.

 

3 Responses to “OTRS – Adding Templates to OTRS”

  1. Craig says:

    Thanks so much for this for posting this, worked a treat! You’re so right, a button(s) never made sense, only a dropdown. Cheers!

  2. Francisco Moix says:

    I know that you posted this more than a year ago. However I am a bit stuck, you mention that we need to add a id=”some_name” to the select tag, but isnt there one already there called template? How do I link the different forms to the option value?

    Thanks in advance.

    $Text{“Templates”}:

    $Text{“Choose Template…”}
    $Text{“Passsword Reset”}
    $Text{“Virus Malware”}

    ###################################################

    # example template form for customizations

  3. Jeff Eske says:

    Francisco,

    I haven’t been working with OTRS for some time now, but I think that I messed up with what I stated. I think it should be that you need to add the id=”some_text” to each FORM, not option. That text will then match the list in the options (Text{“Password Reset”}, Text{“Virus Malware”}, etc.).

    Jeff

Leave a Reply

You must be logged in to post a comment.