[rt-users] RT4.0.4 Custom Scrip Guidance

Ronald J. Yacketta yacketrj at potsdam.edu
Thu Jan 26 13:05:58 EST 2012


On 1/26/2012 11:55 AM, Kevin Falcone wrote:
> 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
> matching.
>
>> 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
> problem.
>
> 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
> TransactionObj->FirstCustomFieldValue
>
> Please don't change all your Scrips to TransactionBatch, as it causes
> the Preview Scrips feature to not work.
>
> -kevin
>
>
> --------
> RT Training Sessions (http://bestpractical.com/services/training.html)
> * Boston --- March 5&  6, 2012
Kevin,

THANKS!!
Works like a champ now!!

-Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20120126/b7a28cb7/attachment.htm>


More information about the rt-users mailing list