[rt-users] How can i search the contents of a transaction when creating a new ticket

scott.dalzell scott.dalzell at aveva.com
Wed Nov 13 11:51:38 EST 2013


solved my own problem.
first it searches for the requestors email address or reference number
matches a certain value
if it does it will then chop up the standard emails contents to get the
users email address
it will then remove the old requestor and add the new requestor 




#######################################
#Variables
#######################################
my $trans = $self->TransactionObj; 
my $ticket = $self->TicketObj;

my $trigger ="No";
my $EmailBad = 'website-no-reply at lfm-software.com';

my $out="";
my $length=0;
my $fragment="";
my $fragmentSearch1="Contact Email Add: ";
my $fragmentSearch2="Contact Tel:";

#######################################
#Set Trigger for switching scrip on
#######################################

if ($trans->Creator()=='11434'){
$trigger="YES";
}
if($ticket->IsWatcher( Type=>"Requestor", Email => $EmailBad)){
$trigger="YES";
}
if ($trigger eq 'YES'){

#######################################
#get contents and return email address
#######################################
$out=$trans->Content(); 
$length = length($out); 
$fragment = substr $out, index($out, $fragmentSearch1);
$fragment = substr $fragment,
length($fragmentSearch1),(-1*(length($fragment)-index($fragment,
$fragmentSearch2)));

#######################################
#removes one requestor and replaces it with an other
#######################################

$ticket->DeleteWatcher( Type=>"Requestor", Email => $EmailBad);
$ticket->AddWatcher(Type => "Requestor", Email => $fragment); 
return 1;
}


its might not be the most elegant way of doing it but it does the job




--
View this message in context: http://requesttracker.8502.n7.nabble.com/How-can-i-search-the-contents-of-a-transaction-when-creating-a-new-ticket-tp55795p55797.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.



More information about the rt-users mailing list