Using callbacks to modify how the correspondence transactions are displayed while viewing a ticket

Hello,

I was attempting to modify how a ticket is shown at https://rtir.domain.com/RTIR/Display.html?id=xxxxxxx using the information from here:

https://rt-wiki.bestpractical.com/wiki/CustomizingWithCallbacks

I quickly realized this would affect the display of tickets for RT using /Ticket.html?id=xxxxxx but not for RTIR.

What it is I’m trying to do is make it so that correspondence added by the System User is hidden but viewable with a Show button if they wish to see it. I want to do something similar to how the show outgoing email thing works so by default the ticket display shows only human communication but the System User correspondence can be shown.

How and where does one create a callback for RTIR ticket displays where I can modify the output if the user who created the transaction is the System User?

Landon Stewart
Lead Analyst - Abuse and Security Management
INTERNAP ®
:e-mail: lstewart@internap.commailto:lstewart@internap.com
:earth_africa: www.internap.comhttp://www.internap.com

You’ll find the RTIR code installed in local/plugins/RT-IR.

For what you’re trying to do, you’ll probably end up evaluating each
transaction in the history. You might be able to start by looking at
this existing callback:

Since there is an existing callback, you would need copy and modify or
add a callback to the callback to add your code. The advantage of that
approach is that your local change to the official RTIR file is only the
single callback line, which is easier to port forward when you upgrade.On 9/19/16 2:07 PM, Landon Stewart wrote:

Hello,

I was attempting to modify how a ticket is shown
at https://rtir.domain.com/RTIR/Display.html?id=xxxxxxx using the
information from here:

https://rt-wiki.bestpractical.com/wiki/CustomizingWithCallbacks

I quickly realized this would affect the display of tickets for RT using
/Ticket.html?id=xxxxxx but not for RTIR.

What it is I’m trying to do is make it so that correspondence added by
the System User is hidden but viewable with a Show button if they wish
to see it. I want to do something similar to how the show outgoing
email thing works so by default the ticket display shows only human
communication but the System User correspondence can be shown.

How and where does one create a callback for RTIR ticket displays where
I can modify the output if the user who created the transaction is the
System User?


Landon Stewart
Lead Analyst - Abuse and Security Management
INTERNAP ®
:e-mail: lstewart@internap.com mailto:lstewart@internap.com
:earth_africa: www.internap.com http://www.internap.com


RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training

  • Boston - October 24-26
  • Los Angeles - Q1 2017

You’ll find the RTIR code installed in local/plugins/RT-IR.

For what you’re trying to do, you’ll probably end up evaluating each transaction in the history. You might be able to start by looking at this existing callback:

Since there is an existing callback, you would need copy and modify or add a callback to the callback to add your code. The advantage of that approach is that your local change to the official RTIR file is only the single callback line, which is easier to port forward when you upgrade.

Thanks Jim.

I’m having a little difficulty understanding this part “you would need copy and modify or add a callback to the callback to add your code”. Do you mean that I should copy a file to a new file and put my code in there? Also I tried modifying the original file (I’m using RT 4.2 w/ RTIR 3.2) at /opt/rt4/local/plugins/RT-IR/html/Callbacks/RTIR/Elements/ShowHistory/SkipTransaction with the following and it didn’t change the output of a ticket at all. (After making the change I did restart the web server and cleared the mason cache).

return unless $Transaction-Type eq ‘Correspond’
&& $Transaction->Creator == RT->SystemUser->id;

I think I don’t understand how $$skip gets set to one when I want to skip something if nothing else stops the call back with a return (I believe). I see it is set to 1 at the bottom of the callback and it seems like it is allowed to do this if nothing else stops it from finishing the script like a ‘return unless …’ but the logic seems backwards to me. Basically I want to not show a Correspond transaction if it was created by the System User. I actually want to collapse it into an expandable button but that’s a whole different beast at this point, first things first.

Landon Stewart
Lead Analyst - Abuse and Security Management
INTERNAP ®
:e-mail: lstewart@internap.commailto:lstewart@internap.com
:earth_africa: www.internap.comhttp://www.internap.com