[rt-users] Custom Fields / Transaction Custom Fields in Scrips
Brooks, Travis C.
travis at slac.stanford.edu
Fri Jul 7 15:44:31 EDT 2006
The following works in RT3.6, both on creation, and on change of the CF.
user def Condition:
return(undef) if ($self->TicketObj->TimeEstimated);
return(undef)
unless($self->TicketObj->FirstCustomFieldValue('spires-difficulty'));
user def Action prep:
my $diff=$self->TicketObj->FirstCustomFieldValue('spires-difficulty');
my $te=60;
if ($diff eq 'Small'){
$te=400;
}
if ($diff eq 'Medium'){
$te=1600;
}
if ($diff eq 'Big'){
$te=6400;
}
$self->TicketObj->setTimeEstimated($te);
Note that I'm accessing the CF value by name. This CF is single valued so
FirstCustomFieldValue works fine.
Perhaps this is close to what you need?
Travis C. Brooks
SPIRES Scientific Databases Manager
Stanford Linear Accelerator Center
http://www.slac.stanford.edu/spires
On Fri, 7 Jul 2006, Mike Coakley wrote:
> Hello all...
>
> In further attempts to get this working I've done the following:
>
> 1. I upgraded to RT 3.6.0. Upgrade went smooth but this still does not work.
>
> 2. In further research I found an article in the archives that stated that
> this was a known issue back in the 3.4 timeframe basically stating the the
> Transaction Custom Fields don't get populated until after the scrips are
> run. There was a patch file available through the archives but this patch
> file also did not fix my issue.
>
> So, I'm wondering if anyone has any further help or places I can look.
>
> Thanks,
>
> --
> Mike Coakley
> Managed Business
> http://www.managedbusiness.com
> http://my.managedbusiness.com
> Voice - 973-252-0770 x2100
> Fax - 973-252-1797
>
>
>
>
> > From: Mike Coakley <mcoakley at managedbusiness.com>
> > Date: Wed, 05 Jul 2006 16:02:42 -0400
> > To: <rt-users at lists.bestpractical.com>
> > Conversation: Custom Fields / Transaction Custom Fields in Scrips
> > Subject: [rt-users] Custom Fields / Transaction Custom Fields in Scrips
> >
> > I'm trying to write a custom condition that will trigger every time a
> > transaction custom field is updated that will update other custom fields.
> > The idea is to keep track of time in a better way.
> >
> > So I have 2 custom fields: Billable Time and Non-Billable Time. These are
> > attached to a ticket. I can easily manually update these fields. I also have
> > two Transaction based custom fields: TRANS Billable Time and TRANS
> > Non-Billable Time. I want to have a condition that fires when the "TRANS*"
> > fields get updated. Then when the condition is fired the action will be to
> > update the Billable Time and Non-Billable Time field appropriately.
> >
> > I've been doing some debugging within the Scrip condition and it appears the
> > condition gets tested twice during a "comment" (haven't worked on reply
> > yet). BUT I don't see the transaction custom field values so my condition
> > fails. So I'm either not retrieving the transaction custom field values
> > improperly (I get no value) or I'm not seeing the right condition.
> >
> > Anyone have any ideas?
> >
> > Thanks,
> >
> > --
> > Mike Coakley
> > Managed Business
> > http://www.managedbusiness.com
> > http://my.managedbusiness.com
> > Voice - 973-252-0770 x2100
> > Fax - 973-252-1797
> >
> >
> >
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Community help: http://wiki.bestpractical.com
> > Commercial support: sales at bestpractical.com
> >
> >
> > Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> > Buy a copy at http://rtbook.bestpractical.com
> >
> >
> > We're hiring! Come hack Perl for Best Practical:
> > http://bestpractical.com/about/jobs.html
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>
>
> We're hiring! Come hack Perl for Best Practical: http://bestpractical.com/about/jobs.html
>
More information about the rt-users
mailing list