[rt-users] CustomField Transactions Options?
Kai Storbeck
kai at xs4all.nl
Tue Jun 25 16:22:57 EDT 2013
Hi mloughran,
On 6/24/13 5:58 PM, Emmanuel Lacour wrote:
> On Mon, Jun 24, 2013 at 08:26:53AM -0700, namespace wrote:
>> I have a custom field entry that when selected, I want to automatically add a
>> watcher to the ticket in question. As it stands, this CustomField called
>> *'Service Type'* has an entry for PO's that when selected should add
>> 'purchasing at fibermedia.net' as a watcher without having the operator
>> manually add the entry. I don't see anywhere in the customfield options to
>> add a watcher, only to notify existing individuals associated with the
>> ticket. Anyone got any input on this?
I ran into a quite similar case just a few months ago.
> You have to do this with a "scrip".
Our Custom Condition Code checks if the customfield 'Severity' is changed:
> return 0 unless $self->TransactionObj->Type eq 'CustomField';
> my $cf = RT::CustomField->new( $self->CurrentUser );
> $cf->SetContextObject( $self->TransactionObj );
> $cf->Load( $self->TransactionObj->Field );
> return 1 if $cf->Name() eq 'Severity';
>
> return 0;
And for our custom action prepare (or cleanup, I never know which to pick):
> for ($self->TransactionObj->NewValue) {
> if (m/^Major$/) {
> $self->TicketObj->AddWatcher(Type => 'Requestor', Email => 'major-incident at name.local');
> }
> elsif (m/^Critical$/) {
> $self->TicketObj->AddWatcher(Type => 'Requestor', Email => 'critical-incident at name.local');
> }
> }
>
> for ($self->TransactionObj->OldValue) {
> if ( m/^Critical$/ ) {
> $self->TicketObj->DeleteWatcher(Type => 'Requestor', Email => 'critical-incident at name.local');
> }
> elsif ( m/^Major$/ ) {
> $self->TicketObj->DeleteWatcher(Type => 'Requestor', Email => 'major-incident at name.local');
> }
> }
>
> return 1;
The added (or removed) watcher addresses expand to SMS in this case.
Regards,
Kai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 906 bytes
Desc: OpenPGP digital signature
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130625/99ccb644/attachment.sig>
More information about the rt-users
mailing list