User::PrincipleID unimplemented in RT::Condition::UserDefined

Hello all,

I’m setting up a scrip to either allow or block notifying the owner of a ticket about transactions. If the owner and requestor are the same user, don’t notify, since the requestor already gets the email. If they’re different, do notify, so they both get it. My scrip looks like this:

  • Condition: user defined
  • Action: notify owner
  • applies: globally
  • enabled: yes

Custom condition code:

my $ticketRequestor = $self->TicketObj->Requestors->First->eID;
my $transactionType = $self->TransactionObj->Type;
my $validTransactionType = "Correspond";

if ($self->TicketObj->IsRequestor($ticketOwner) && $transactionType eq $validTransactionType) {
    RT::Logger.info("Not emailing owner because user #" . $ticketRequestor . " is requestor and owner of ticket " . $self->TicketObj->Id);
    return 0;
}
return 1;

Preparation:

return 1;

Execution:

return 1;

The error I’m seeing is on line 1. It says:

Scrip 25 IsApplicable failed: RT::User::PrincipleID unimplemented in RT::Action::UserDefined ((eval 1780) line 1)

I’ve tried OwnerObj->ID, but with the same effect on the same line. Am I missing an import? Some key step? The RT docs I’ve been reading say that OwnerObj is an instance of RT::User, and User has a PrincipleID attribute I can access. I don’t know why this code doesn’t work. I’m on RT4.4.1, in case that matters. Thanks for any ideas!

Never mind, I got it. First, I had an “e” before “ID”, which obviously caused problems. Second, I had “ID” (capitalized) but RT wants “id” (lowercase). Finally, I had to call things differently to get the requestor’s ID. The way we’re set up, no ticket will ever have multiple IDs, so I can trust the first one to be the only one. Here’s my revised, and working, scrip. This is in the “condition” field for a “notify owner” scrip. See my previous post in this thread for the full scrip details. Anyway, the condition is:

my $ticketOwner = $self->TicketObj->OwnerObj->id;
my $ticketRequestor = $self->TicketObj->Requestors->MembersObj->First->id;
my $transactionType = $self->TransactionObj->Type;

#we don't need notifications for anything other than create/correspond
return 0 if $transactionType !eq "Create" || $transactionType !eq "Correspond";

#if the owner is the requestor, exit
if ($self->TicketObj->IsRequestor($ticketOwner)) {
    RT::Logger.info("Not emailing owner because user #" . $ticketRequestor . " is requestor and owner of ticket " . $self->TicketObj->Id);
    return 0;
}

#if we haven't returned yet, we're good, so notify the owner by returning 1
return 1;

1 Like