Skip to content
  • Todd Wade's avatar
    add a way to give an attribute an ObjectType besides RT::System · e7290b0e
    Todd Wade authored
    This code allows you to provide a code ref in the Object field in an Attribute
    initialdata hash that returns an object that can be used as the ObjectType for
    the Attribute:
    
    @Attributes = ({
        Name        => 'SavedSearch',
        Description => 'New Tickets in SomeQueue',
        Object      => sub {
            my $GroupName = 'SomeQueue Group';
            my $group     = RT::Group->new( RT->SystemUser );
    
            my( $ret, $msg ) = $group->LoadUserDefinedGroup( $GroupName );
            die $msg unless $ret;
    
            return $group;
        },
        Content     => {
            Format =>  <<'        END_OF_FORMAT',
    ....
            END_OF_FORMAT
            Query   => "Status = 'new' AND Queue = 'SomeQueue'",
            OrderBy => 'id',
            Order   => 'DESC'
        },
    });
    e7290b0e