Scrip Question

Please excuse me if this is a silly or repetitive question, but I’m
trying to create a scrip that changes the owner to nobody on a ticket if
a user corresponds back to the ticket…

I have the following setup, but nothing seems to be happening…

Condition: User Defined
Custom Condition:

if (($self->TransactionObj->Type eq “Correspond”) and
($self->TicketObj->OwnerObj->Id != $RT::Nobody->Id)) {
return(1);
} else {
return(undef);
}

Action: User Defined
Custom action prep:

my $retval = undef;
if ( defined( $self->TicketObj->OwnerObj->id ) ){
    if( $self->TicketObj->OwnerObj->Id != $RT::Nobody->Id ){
    $retval = 1;
    }
}

Custom action cleanup:

my $retval = undef;
if ($self->TransactionObj->CreatorObj->Id !=
$self->TicketObj->OwnerObj->Id)
{
$RT::Logger->info(“Untake ticket”);

They don’t own the ticket. Untake it.

$retval = $self->TicketObj->SetOwner($RT::Nobody->Id);
}

return( $retval );

Template: Global template: Blank

Am I missing something? Please enlighten :slight_smile:

Regards,

Derek Buttineau
Internet Systems Administrator
Compu-SOLVE Internet Services

Derek Buttineau wrote:

Please excuse me if this is a silly or repetitive question, but I’m
trying to create a scrip that changes the owner to nobody on a ticket
if a user corresponds back to the ticket…

I have the following setup, but nothing seems to be happening…

Condition: User Defined
Custom Condition:

if (($self->TransactionObj->Type eq “Correspond”) and
($self->TicketObj->OwnerObj->Id != $RT::Nobody->Id)) {
return(1);
} else {
return(undef);
}

Action: User Defined
Custom action prep:

First of all you don’t need this ‘IF’ you have allready checked it in
condition. Don’t you think so?

my $retval = undef;
if ( defined( $self->TicketObj->OwnerObj->id ) ){
if( $self->TicketObj->OwnerObj->Id != $RT::Nobody->Id ){
$retval = 1;
}
}

You don’t have return here !
return $retval;

Turn on debug to separate file in RT’s config. Each step of user defined
scrips go through "eval"s and log nay error.

Custom action cleanup:

my $retval = undef;
if ($self->TransactionObj->CreatorObj->Id !=
$self->TicketObj->OwnerObj->Id)
{
$RT::Logger->info(“Untake ticket”);

They don’t own the ticket. Untake it.

$retval = $self->TicketObj->SetOwner($RT::Nobody->Id);
}
return( $retval );

Template: Global template: Blank

May be better deny to take tickets that were requested by somebody else?

Hi,

I want to check if a Custom Field Value is Set to a particular value and if
so don’t send autoreply on TicketCreate.

My Question is how do I select a Custom field Value within a scrip?

Regards,

*Aaron Guise
027 212 6638
aaron@guise.net.nz

Found it,

$TicketObj->FirstCustomFieldValue(‘The CF Name’);On Thu, Jun 11, 2009 at 9:59 AM, Aaron Guise aaron@guise.net.nz wrote:

Hi,

I want to check if a Custom Field Value is Set to a particular value and if
so don’t send autoreply on TicketCreate.

My Question is how do I select a Custom field Value within a scrip?

Regards,

*Aaron Guise
027 212 6638
aaron@guise.net.nz
*

Hi All,

Silly question but, how can I access the Attachments for a related
Transaction via a scrip? I am wanting to collect a piece out of the
plaintext content to populate a CF on comment.

Regards,

Aaron

Hello Aaron,

$txn->Content returns text of the comment/reply, but if you need all
attachements then you should walk $txn->Attachments collection.On Fri, Nov 13, 2009 at 6:18 AM, Aaron Guise aaron@guise.net.nz wrote:

Hi All,

Silly question but, how can I access the Attachments for a related
Transaction via a scrip? I am wanting to collect a piece out of the
plaintext content to populate a CF on comment.


Regards,

Aaron


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

Thanks,

That was exactly as I needed.On Fri, Nov 13, 2009 at 6:46 PM, Ruslan Zakirov ruslan.zakirov@gmail.comwrote:

Hello Aaron,

$txn->Content returns text of the comment/reply, but if you need all
attachements then you should walk $txn->Attachments collection.

On Fri, Nov 13, 2009 at 6:18 AM, Aaron Guise aaron@guise.net.nz wrote:

Hi All,

Silly question but, how can I access the Attachments for a related
Transaction via a scrip? I am wanting to collect a piece out of the
plaintext content to populate a CF on comment.


Regards,

Aaron


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Best regards, Ruslan.

Regards,

Aaron