[rt-users] COndition on customfield change

Munoz, Alvaro alvaro.munoz at hp.com
Fri Feb 8 09:25:57 EST 2008


Hi Benjamin,

I looked at the wiki and the list before posting, but the problem is that newValue and oldValue attributes are not set in the transaction.

+-------+------------+----------+-----------+-------------+-------+----------+----------+----------------------------+--------------+--------------+------+---------+---------------------+
| id    | ObjectType | ObjectId | TimeTaken | Type        | Field | OldValue | NewValue | ReferenceType              | OldReference | NewReference | Data | Creator | Created             |
+-------+------------+----------+-----------+-------------+-------+----------+----------+----------------------------+--------------+--------------+------+---------+---------------------+
| 25207 | RT::Ticket |      188 |         0 | CustomField | 323   | NULL     | NULL     | RT::ObjectCustomFieldValue |         NULL |         6992 | NULL |      12 | 2008-02-08 15:05:39 |
+-------+------------+----------+-----------+-------------+-------+----------+----------+----------------------------+--------------+--------------+------+---------+---------------------+

There should be a way to get those values within the scrip. How does ticket history transaction get those values to print?

#       Vie. Feb. 08 16:46:20 2008       root - Valor de "Fase" ha cambiado de 'primera' a 'segunda'

Thanks again,

Alvaro Muñoz Sánchez
Technical Consultant
Hewlett Packard Consulting & Integration
Phone: 628 13 01 36
E-Mail: alvaro.munoz at hp.com
P Antes de imprimir piensa en el medio ambiente

-----Original Message-----
From: Benjamin Weser [mailto:weser at osp-dd.de]
Sent: viernes, 08 de febrero de 2008 14:53
To: Munoz, Alvaro
Cc: RT Users
Subject: Re: [rt-users] COndition on customfield change

Alvara,

have a look at http://wiki.bestpractical.com/view/Contributions, there are several examples how to read and manipulate the values of CFs via scrips.
First you have to look if the transaction was caused by a CF, something like this:

unless (
 ( $self->TransactionObj->Type eq "CustomField"
   &&  $self->TransactionObj->Field == 6 )  ||  $self->TransactionObj->Type eq "Create"
 ) {
   return 0;
}

Hint: The "6" equals the id of the CF.

Then you can test for OldValue and NewValue. Have a look at the examples mentioned above.

Best,
Ben


Munoz, Alvaro schrieb:
> Hi there,
>
> Is there any way to match a customfiled value change from one specific
> value to another?
>
> Transactions of type "CustomField" leave NewValue and OldValue to NULL
> so I just can know that the field has changed but not the old and new
> values.
> In the ticket history you can see both values, can i use those values
> from a scrip condition?
>
> Thanks in advance!
>
> Alvaro
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> 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




More information about the rt-users mailing list