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

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

Travis,

I can use standard CF fields in a transaction BUT I’m having a problem with
Transactional Custom Fields. When I submit a new ticket or comment/reply on
a ticket the Transactional Custom Fields don’t appear to be accessible
through a Scrip. Standard Global or Queue based Custom Fields are just fine.

So if you are referring to Transactional Custom Field in your reply then I
don’t know what is wrong because my code that basically does what yours does
(i.e. $self->TicketObj->FirstCustomFieldValue) doesn’t work so I have no
idea what could be the problem.

Thanks,

Mike Coakley
Managed Business
http://www.managedbusiness.com
http://my.managedbusiness.com
Voice - 973-252-0770 x2100
Fax - 973-252-1797

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/spiresOn 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@managedbusiness.com
Date: Wed, 05 Jul 2006 16:02:42 -0400
To: rt-users@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


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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:
Careers — Best Practical Solutions


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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: Careers — Best Practical Solutions

Travis,

Thanks for the input.

For the list… I have tried the Transaction Object as well and this does
not work either.

Thanks,

Mike Coakley
Managed Business
http://www.managedbusiness.com
http://my.managedbusiness.com
Voice - 973-252-0770 x2100
Fax - 973-252-1797

For anyone following this thread (doubtful as it is old) I’ve got everything
working. After looking through the code I noticed that the patch that Jesse
had released for 3.4 that I had tried to apply did not apply fro some reason
although I didn’t remember getting any errors. So I re-applied the patch to
my 3.6 and everything is working as I expected it in the past.

So, I concur with Jesse… His patch does fix the issue :smiley:

Now my only question would be why isn’t this patch in the core yet as of
3.6?

Thanks,

Mike Coakley
Managed Business
http://www.managedbusiness.com
http://my.managedbusiness.com
Voice - 973-252-0770 x2100
Fax - 973-252-1797

Unfortunately, the patch violates abstraction barriers all over the place. Io never found a way to do it cleanly------- Original message -------
From: Mike Coakley mcoakley@managedbusiness.com
Sent: 19.7.'06, 16:33

For anyone following this thread (doubtful as it is old) I’ve got everything
working. After looking through the code I noticed that the patch that Jesse
had released for 3.4 that I had tried to apply did not apply fro some reason
although I didn’t remember getting any errors. So I re-applied the patch to
my 3.6 and everything is working as I expected it in the past.

So, I concur with Jesse… His patch does fix the issue :smiley:

Now my only question would be why isn’t this patch in the core yet as of
3.6?

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@managedbusiness.com
Date: Fri, 07 Jul 2006 15:30:03 -0400
To: “rt-users@lists.bestpractical.comrt-users@lists.bestpractical.com
Conversation: [rt-users] Custom Fields / Transaction Custom Fields in Scrips
Subject: Re: [rt-users] Custom Fields / Transaction Custom Fields in Scrips

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@managedbusiness.com
Date: Wed, 05 Jul 2006 16:02:42 -0400
To: rt-users@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


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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:
Careers — Best Practical Solutions


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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:
Careers — Best Practical Solutions


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@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: Careers — Best Practical Solutions

Jesse,

Thanks for the reply and that makes complete sense to this old
C++/Java/Object Pascal (yeah I’m dating myself) programmer. I’ve started to
look through the code for RT but haven’t gotten through it enough to wrap
myself around the object hierarchy and philosophies behind its design. I’ll
keep on digging and maybe I can come up with a patch that can make it into
the core.

Thanks,

Mike Coakley
Managed Business
http://www.managedbusiness.com
http://my.managedbusiness.com
Voice - 973-252-0770 x2100
Fax - 973-252-1797