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 >> 'purchas...@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@name.local'); > } > elsif (m/^Critical$/) { > $self->TicketObj->AddWatcher(Type => 'Requestor', Email => > 'critical-incident@name.local'); > } > } > > for ($self->TransactionObj->OldValue) { > if ( m/^Critical$/ ) { > $self->TicketObj->DeleteWatcher(Type => 'Requestor', Email => > 'critical-incident@name.local'); > } > elsif ( m/^Major$/ ) { > $self->TicketObj->DeleteWatcher(Type => 'Requestor', Email => > 'major-incident@name.local'); > } > } > > return 1; The added (or removed) watcher addresses expand to SMS in this case. Regards, Kai
signature.asc
Description: OpenPGP digital signature