Re: [rt-users] CustomField Transactions Options?
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
Re: [rt-users] CustomField Transactions Options?
On 06/25/2013 01:22 PM, Kai Storbeck wrote: And for our custom action prepare (or cleanup, I never know which to pick): Prepare should be used to do any work needed to do the action's business, or to check some further conditions (depends on the action). No changes should ever be made in prepare since it may be called more than once. All changes should happen in cleanup (which is renamed to commit in 4.2).
[rt-users] CustomField Transactions Options?
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? -- View this message in context: http://requesttracker.8502.n7.nabble.com/CustomField-Transactions-Options-tp54412.html Sent from the Request Tracker - User mailing list archive at Nabble.com.
Re: [rt-users] CustomField Transactions Options?
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? You have to do this with a scrip. Your scrip can be global or only on some queues. As scrip condition, you have to write your own by selecting User defined. You're condition shoudl check that this transactions happens on this CustomField and matches the wanted change. As scrip action, you have also to write your own as User defined, and use the appropriate method of the RT API (http://www.bestpractical.com/rt/docs/4.0/RT/Ticket.html#AddWatcher) to add the watcher. As a template, you can select blank. -- Easter-eggs Spécialiste GNU/Linux 44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité Phone: +33 (0) 1 43 35 00 37- Fax: +33 (0) 1 43 35 00 76 mailto:elac...@easter-eggs.com - http://www.easter-eggs.com
Re: [rt-users] CustomField Transactions Options?
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? There is no built in action for that, you'd need to write a simple User Defined action to call $TicketObj-AddWatcher(...) http://bestpractical.com/rt/docs/latest/RT/Ticket.html#AddWatcher -kevin pgpjpAxgWIGBS.pgp Description: PGP signature