Hi all, I’ve successfully got an autoresolve based upon a single queue & subject criteria working… but I’ve tried now to create subsequent ones in the same queue for different conditions, but they’re not matching.
Basically what I’m aiming for is a library of common terms that don’t need human attention and these get auto closed. e.g.
“Backups successful”
“[0 Errors to report]”
“[Backup success] esx-host (5 vms)”
I suspect the problem is either that the first scrip evaluates it and returns 1 which means it then doesn’t try to evaluate against the remaining scrips OR there’s a problem with my regex in the second two examples around the and ().
I’m not a perl guy so I’m doing this the hard way, as it were.
So scrip #1 looks like: (this one works fine btw)
Condition: oncreate
action: user defined
Template: blank
Applies to: myqueue
custom condition: return 1;
custom action prep code:
my $match = “Backups successful”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
return 0;
}
else {
return 1;
}
Custom action commit code:
$self->TicketObj->SetStatus( “resolved” );
return 1;
=============
scrip #2 which is not working:
Condition: oncreate
action: user defined
Template: blank
Applies to: myqueue
custom condition: return 1;
custom action prep code:
my $match = “[0 Errors to report]”;
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
return 0;
}
else {
return 1;
}
Custom action commit code:
$self->TicketObj->SetStatus( “resolved” );
return 1;
=============
script 3:
Condition: oncreate
action: user defined
Template: blank
Applies to: myqueue
custom condition: return 1;
custom action prep code:
my $match = "[Backup success] esx-host (5 vms";
my $t_subject = $self->TicketObj->Subject;
if ( $t_subject !~ /$match/i ) {
return 0;
}
else {
return 1;
}
Custom action commit code:
$self->TicketObj->SetStatus( “resolved” );
return 1;
=============
I’ve also tried:
if ( $t_subject !~ /\b$match\b/i ) {
instead of:
if ( $t_subject !~ /$match/i ) {
but no difference.
So… is it problem with the regex expression… logic…? is there an easy way to get it to check
$match/$match2/$match3
rather than making separate scrips?
Thanks!
Chris