[rt-users] RT4.0.4 Custom Scrip Guidance

Kevin Falcone falcone at bestpractical.com
Thu Jan 26 11:55:37 EST 2012

On Thu, Jan 26, 2012 at 08:38:42AM -0500, Ronald J. Yacketta wrote:
> All,
> We have an external perl script that trolls through the RT MySQL DB
> looking for recent transactions with a specific CF that has been
> updated. The script will pull out specific data from the DB and
> update an External Site for notifications. The script is used to
> inform the campus when we are planning server maintenance or are
> working on a issue that impacts the campus.
> Would like to convert the external perl script into a RT Custom
> Scrip that acts upon 'Correspond' || 'Comment' && CF modification,
> when those conditions are met the Custom Action will call an
> external perl script with appropriate data to update the
> notification www site.
> Have the following (based on
> http://requesttracker.wikia.com/wiki/OnCustomFieldValueChange) which
> throws 'RT: Couldn't load object RT::Transaction #0
> (/opt/rt4/sbin/../lib/RT/Interface/Web.pm:2164)' in the log

This is just a warning, not an error, and unrelated to your scrip not

> unless (
> (  ($self->TransactionObj->Type eq "Correspond"
>  || $self->TransactionObj->Type eq "Comment")
> &&  $self->TransactionObj->Field == 18 )
> ) {
>    return 0;
> }
> return 0 unless $self->TicketObj->FirstCustomFieldValue('External
> Updates') =~ /Public Status/i;

Your CF is actually a transaction CF, not a ticket cf.
You have to ask for the
TransactionObj->FirstCustomFieldValue('External Updated')
Also, if you have a look in your DB, is Field being set on the
Correspond/Comment transactions for this?

Unfortunately, even with the problem I listed above, you have a worse

Transaction Custom Fields aren't set until After the
Correspond/Comment, which means that the value won't be available to
you in the Scrip Condition.

Your best bet is to make this Scrip a TransactionBatch scrip, which
lets it run last, and then you can check for Correspond or Comment and

Please don't change all your Scrips to TransactionBatch, as it causes
the Preview Scrips feature to not work.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120126/d0dafcc7/attachment.sig>

More information about the rt-users mailing list