Custom condition not working (simple)

How come this does not work? I’ve seen some examples of the “DependOnBy” use returning a numeric value, but looking at RT documentation, it appears it should return an array? Basically, I want it to return 1 if there are no child tickets associated with the current ticket.

if ($self->TransactionObj->Type eq ‘Create’ &&
$self->TicketObj->FirstCustomFieldValue(‘New Hire Request?’)eq ‘Yes’ &&
$self->TicketObj->DependOnBy eq ‘0’) {
return 1;
}

Is there a way to test RT perl code without trial and error, or do you just have to incorporate some logging?

Thanks!

-Matt

How come this does not work? I’ve seen some examples of the “DependOnBy” use
returning a numeric value, but looking at RT documentation, it appears it
should return an array? Basically, I want it to return 1 if there are no child
tickets associated with the current ticket.

First up - it’s DependedOnBy not DependOnBy, and it returns an
RT::Links object, so I’m surprised you’ve seen numeric comparisons.

I suspect you wanted
http://bestpractical.com/docs/rt/latest/RT/Record.html#HasUnresolvedDependencies

Is there a way to test RT perl code without trial and error, or do you just
have to incorporate some logging?

Logging is your friend.

RT->Logger->error(“Stuff”);

You can also always write a command line program to test things
quickly, which is what I usually do.

-kevin

I’m not sure either. This was very helpful - thanks for the response!From: rt-users [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Wednesday, December 17, 2014 11:15 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Custom condition not working (simple)

How come this does not work? I’ve seen some examples of the
“DependOnBy” use returning a numeric value, but looking at RT
documentation, it appears it should return an array? Basically, I
want it to return 1 if there are no child tickets associated with the current ticket.

First up - it’s DependedOnBy not DependOnBy, and it returns an RT::Links object, so I’m surprised you’ve seen numeric comparisons.

I suspect you wanted
http://bestpractical.com/docs/rt/latest/RT/Record.html#HasUnresolvedDependencies

Is there a way to test RT perl code without trial and error, or do you
just have to incorporate some logging?

Logging is your friend.

RT->Logger->error(“Stuff”);

You can also always write a command line program to test things quickly, which is what I usually do.

-kevin

I meant to say I want it to return 1 if there are no PARENT tickets to the current ticket. I would need to use the “DependsOn” or “AllDependsOn”, but I’m not sure how to check the returned array for size.

Working on it.From: rt-users [mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Kevin Falcone
Sent: Wednesday, December 17, 2014 11:15 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Custom condition not working (simple)

How come this does not work? I’ve seen some examples of the
“DependOnBy” use returning a numeric value, but looking at RT
documentation, it appears it should return an array? Basically, I
want it to return 1 if there are no child tickets associated with the current ticket.

First up - it’s DependedOnBy not DependOnBy, and it returns an RT::Links object, so I’m surprised you’ve seen numeric comparisons.

I suspect you wanted
http://bestpractical.com/docs/rt/latest/RT/Record.html#HasUnresolvedDependencies

Is there a way to test RT perl code without trial and error, or do you
just have to incorporate some logging?

Logging is your friend.

RT->Logger->error(“Stuff”);

You can also always write a command line program to test things quickly, which is what I usually do.

-kevin