>>    But I'd like to re-write the subject with some of the information 
>> contained in the custom fields..
>>    I assume it's a Scrip, On Create, running after our ExtractCF scrip...

>Yes, it's an On Create with a User Defined action, Prepare would be 1; and 
>Commit would call $self->TicketObj->SetSubject() passing in the data you want.

I've created a scrip in the Global and in the Queue itself to try and get this 
working...

So far I have: 

Description:     " 020 - Set subject based on custom field"
Condition:      On Create
Action:         User Defined
Template:       Global Template: Blank
Stage:          Transaction Create


Custom Condition:
$RT::Logger->info("Running Scrip #020 Set Subject");
my $subject = $self->TicketObj->FirstCustomFieldValue('Address');
my ($status, $msg) = $self->TicketObj->SetSubject($subject) ;
unless ( $status ) {
    $RT::Logger->error("Couldn't change the subject due to: $msg");
    return 0;
}
return 1;

Custom action prepare code: 
return 1;

Custom action cleanup code:
return 1;


I set the logging in RT to debug, and I can see the scrip executing after the 
extraction of custom fields.. (It's #15) but the subject isn't set...
...
 [info]: CustomFieldValue (Pager, 025 ) added: 237  
(/opt/rt4/local/plugins/RT-Extension-ExtractCustomFieldValues/lib/RT/Action/ExtractCustomFieldValues.pm:213)
 [debug]: Committing scrip #15 on txn #1451 of ticket #194 
(/opt/rt4/sbin/../lib/RT/Scrips.pm:192)
 [debug]: Committing scrip #3 on txn #1451 of ticket #194 
(/opt/rt4/sbin/../lib/RT/Scrips.pm:192)
 [debug]: Committing scrip #4 on txn #1451 of ticket #194 
(/opt/rt4/sbin/../lib/RT/Scrips.pm:192)
 [debug]: Calling SetRecipientDigests for transaction 
RT::Transaction=HASH(0x7f1ad539b878), id 1451 
(/opt/rt4/sbin/../lib/RT/Action/SendEmail.pm:641)
 [debug]: Working on mailfield To; recipients are  
(/opt/rt4/sbin/../lib/RT/Action/SendEmail.pm:657)
 [debug]: Subject: [RT #194] test 11

Reply via email to