I have to modify the global template in RT so the AutoResponse via email is
different during office hours and after hours. For Example at 9AM it should
say Thank you for contacting Help-desk etc. , and at 5PM will say that the
office is currently closed, all tickets will be looked at tomorrow morning.
Now, I have achieve this modifying directly using simple MySQL statement in
bash script to insert my text in the rtdb.Templates table Contents field and
injecting the text form the text files. Although it works with Cron jobs
running at 9AM and 5PM, I was wondering if there is a way to do it via API,
since it is more elegant and overall better solution.
I think (never tried) that it could be possible to write a custom scrip
action that select the template based on a time condition.
This way you have just to use this action where needed and create the
pre-defined templates without changing them dynamically.
You can also write perl conditions in your template, using {}. Thought
too much perl in templates make them often difficult to read/modify.
If you prefer to stay with a cron job you would better write it using
perl and use the RT API to change the template. Writing directly to the
RT DB is always a bad idea imho.
Thank you Emmanuel!
I was looking into it and since Perl is not my first language I was
thinking on using custom conditions something like listed here: http://requesttracker.wikia.com/wiki/CustomConditionSnippets
The idea is to have 2 AutoResponse templates with different messages, one
for daytime own done for after hours. When the ticket is created, this
condition is evaluated and proper AutoResponse Template is used. I was
thinking about something along these lines (snippet from the web):
#!/usr/local/bin/perl
@months = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); @days = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
Both Scrips are using the same condition with and one with 2 different
templates chosen based on the condition, so it should be one or the other,
but not both as in my test…
Any ideas?
Both Scrips are using the same condition with and one with 2 different
templates chosen based on the condition, so it should be one or the other,
but not both as in my test…
Custom conditions only run when your Condition is “User Defined”
Your condition is On Create, so your code is never run (you can see
this by adding RT->Logger->error(“Running?”); commands to your code.
If I use the “Notify requestors” Action, the script condition works but the problem is if the requestor is not an internal user or a client it doesn’t autoresponse.