[rt-users] Odd behavior, RT automatically reverts changes to Custom Fields

Ruslan Zakirov ruz at bestpractical.com
Fri Jun 15 12:26:28 EDT 2012


It's known issue with scrips that set custom fields based on other
fields. You workaround it either by not allowing people to change
custom fields you auto set with scrips or by running your scrip in
batch stage.

Some details. RT processes updates to custom fields one by one from
request args, your scrip kicks in in the middle and then RT thinks,
when it gets to a field that was changed by a scrip, that user picked
different value and changes it back.

On Thu, Jun 14, 2012 at 5:48 PM, Matthew W. <matt.k.wong at gmail.com> wrote:
> Hello,
> I'm relatively new to RT and have been running into this problem for a
> few days now.  I've looked everywhere and haven't found a clue.  The
> closest thing I could find was documented in this post:
> http://www.mail-archive.com/rt-users@lists.bestpractical.com/msg10037.html
> But, I really don't want to to undo the changes that RT automatically
> undoes....
> Basically, whenever I make changes to a custom field from a scrip
> whatever the value that I add automatically gets reverted back to the
> old value.  I tried adding code to delete the old value first, but RT
> just adds the old value back.
> Here's some psuedocode (code not tested and may contain typos, but my
> code works just fine as I can see the transactions in the ticket
> history):
> my $Value = 'some value';
> my $CFName = 'customCF';
> my $CF->LoadByName( Name => $CFName);
> #Delete the old value:
> $self->TicketObj>DeleteCustomFieldValue(
>     Field => $CFName,
>     Value => $self->TicketObj->FirstCustomFieldValue($CFName)
> );
> #Set the new value:
> $self->TicketObj->AddCustomFieldValue( Field => $CF, Value => $Value);
> Bottom line: does anyone know how to prevent RT from undoing the
> additions to a custom field?  This is in RT 4.0.4.
> --Matthew.

Best regards, Ruslan.

More information about the rt-users mailing list