COndition on customfield change

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

Alvara,

have a look at Contributions - Request Tracker Wiki, 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 Benjamin,

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

Alvaro Muñoz Sánchez
Technical Consultant
Hewlett Packard Consulting & Integration
Phone: 628 13 01 36
E-Mail: alvaro.munoz@hp.com
P Antes de imprimir piensa en el medio ambienteFrom: Benjamin Weser [mailto:weser@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 Contributions - Request Tracker Wiki, 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



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

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@hp.com
P Antes de imprimir piensa en el medio ambienteFrom: Benjamin Weser [mailto:weser@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 Contributions - Request Tracker Wiki, 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



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

Alvaro,

seems the changes of custom fields are not in table Transactions at
NewValue and OldValue but linked from OldReference and NewReference.
Nevertheless you can read the values by first checking if the
transaction was caused by the special CF like I mentioned before and
then you can read old and new value using the TransactionObj like this:
$self->TransactionObj->OldValue and $self->TransactionObj->NewValue. I
have to admit, I don’t know how it works internally but I never really
cared because it works for me this way. :wink:

Give it a try.

Munoz, Alvaro wrote: