Customize Autoreply.pm with overlay for use with git?


#1

Hi all,

Image we would like to create an action “Autoreply To Requestors With Exceptions” (e.g. like https://rt-wiki.bestpractical.com/wiki/OnCreateAutoReplyException), but we would we like to keep track of our changes in our own git repository (so not using the RT gui for User Defined, that makes it difficult to keep track on history and who changed what etc.), what would be the best strategy:

  1. Make a copy of Autoreply.pm and write a custom Action
  2. Write an overlay to the “sub Prepare” section in Autoreply.pm

Second, would any of you have an example on such a customization?

I was writing a custom action after I realized a needed to include the AutoReply mechanism to work.

Thanks in advance,

Best, Marit


#2

Hi Marit,

You have two options here for creating this in a file, the first option is to create the file in your RT directory and just check that in. Assuming RT is installed in /opt/rt4/ You would create the following directory:

/opt/rt4/local/lib/RT/Action/MyAction.pm

This would allow you to then create a new action in the RT GUI using MyAction.pm as the action module. This is nice but it doesn’t allow for all the changes to be tracked by git.

The better (But requires slightly more effort) option would be to create an extension where you can store all your customization.

https://docs.bestpractical.com/rt/4.4.4/writing_extensions.html

In the extension you can create the action file once again but this time you can also create an initaldata file which can create the scrip and insert it into your RT database for you.

https://docs.bestpractical.com/rt/4.4.4/initialdata.html

A good example of an extension that creates a custom action and scrip is this one:

You can take a look at etc/initaldata and lib/RT/Action/.

Once this extension is done you can install it like any other RT extension.