SetStatus and SetOwner scrip question

RT 3.6.1

Condition: On Queue Change
Action: User Defined
Template: Not sure which one I should be using

I figure that that the Custom action cleanup code should be
$self->TicketObj->SetStatus(“new”); and $self->TicketObj->SetOwner(“Nobody”);
but nothing happens.

This is my first attempt at a custom scrip so I don’t know what needs to be
done/in place for it to work. My Custom Condition is blank, my Custom action
preparation code is blank.

Any thoughts?
Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

Hi Mathew,

If you have that code in the Cleanup area, make sure you have a “return 1;”
in the Prep area (otherwise the Cleanup code doesn’t execute).

I’m not sure that you can pass “Nobody” to the SetOwner method; I think it
wants an Id rather than a name. Use $RT::Nobody->Id to get the Id for
“Nobody”:
$self->TicketObj->SetOwner($RT::Nobody->Id);

Regarding which template, it doesn’t matter because User Defined actions
can’t access templates. I always set it to Global:Blank so I don’t think
that it’s actually doing anything.

Regards,
Gene

At 08:23 AM 8/14/2007, Mathew Snyder wrote:

RT 3.6.1

Condition: On Queue Change
Action: User Defined
Template: Not sure which one I should be using

I figure that that the Custom action cleanup code should be
$self->TicketObj->SetStatus(“new”); and $self->TicketObj->SetOwner(“Nobody”);
but nothing happens.

This is my first attempt at a custom scrip so I don’t know what needs to be
done/in place for it to work. My Custom Condition is blank, my Custom action
preparation code is blank.

Any thoughts?
Mathew

Keep up with me and what I’m up to: http://theillien.blogspot.com


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

Gene LeDuc, GSEC
Security Analyst
San Diego State University

I did what you suggested. It still isn’t having an effect. The owner doesn’t
change nor does the status.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Gene LeDuc wrote:

From your first post, I’m guessing that you want the status and owner set
when a ticket is moved into a specific queue. Is this correct?

Is your scrip in the “incoming” queue, the queue that the ticket is being
moved into?

Is anything being logged in your rt.log file?

At 09:39 AM 8/14/2007, Mathew Snyder wrote:

I did what you suggested. It still isn’t having an effect. The owner doesn’t
change nor does the status.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Gene LeDuc wrote:

Hi Mathew,

If you have that code in the Cleanup area, make sure you have a “return
1;” in the Prep area (otherwise the Cleanup code doesn’t execute).

I’m not sure that you can pass “Nobody” to the SetOwner method; I think
it wants an Id rather than a name. Use $RT::Nobody->Id to get the Id
for “Nobody”:
$self->TicketObj->SetOwner($RT::Nobody->Id);

Regarding which template, it doesn’t matter because User Defined actions
can’t access templates. I always set it to Global:Blank so I don’t
think that it’s actually doing anything.

Regards,
Gene

At 08:23 AM 8/14/2007, Mathew Snyder wrote:

RT 3.6.1

Condition: On Queue Change
Action: User Defined
Template: Not sure which one I should be using

I figure that that the Custom action cleanup code should be
$self->TicketObj->SetStatus(“new”); and
$self->TicketObj->SetOwner(“Nobody”);
but nothing happens.

This is my first attempt at a custom scrip so I don’t know what needs
to be
done/in place for it to work. My Custom Condition is blank, my Custom
action
preparation code is blank.

Any thoughts?
Mathew

Keep up with me and what I’m up to: http://theillien.blogspot.com


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

Gene LeDuc, GSEC
Security Analyst
San Diego State University

I figured out part of it: Typo was causing problems. As a result, the status is
now being set to “new” as I was looking for. However, the owner is not being
changed.

I’m not seeing any errors in rt.log that would indicate why this is. I’ve only
seen the messages telling me that scrips were being prepared and commits were
being made.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Gene LeDuc wrote:

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any problems. I have
it set up with debug so I know I’m getting as much info as I can.

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

Gene LeDuc wrote:

At Tuesday 8/14/2007 02:14 PM, Mathew Snyder wrote:

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any problems. I have
it set up with debug so I know I’m getting as much info as I can.

Mathew,

You may be running into something that’s bitten us before - let’s say
the ticket is currently owned by “theillien” and you change the
queue. The scrip will change the owner to Nobody, then the form input
is processed. RT sees that the owner is Nobody and that the owner
field on the form is “theillien”, so it interprets this as a change
from Nobody to theillien and you end up where you started. Do you
have any entries in the ticket history showing any ownership changes?

Steve

Stephen Turner wrote:

At Tuesday 8/14/2007 02:14 PM, Mathew Snyder wrote:

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any
problems. I have
it set up with debug so I know I’m getting as much info as I can.

Mathew,

You may be running into something that’s bitten us before - let’s say
the ticket is currently owned by “theillien” and you change the queue.
The scrip will change the owner to Nobody, then the form input is
processed. RT sees that the owner is Nobody and that the owner field on
the form is “theillien”, so it interprets this as a change from Nobody
to theillien and you end up where you started. Do you have any entries
in the ticket history showing any ownership changes?

Steve

Steve,

No, I’m not seeing that. Only two actions are being displayed when I move the
ticket:

msnyder - Queue changed from CustomerCare to CCEng
RT_System - Status changed from ‘open’ to ‘new’

Nothing saying “Given to …”

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

Stephen Turner wrote:

At Tuesday 8/14/2007 02:14 PM, Mathew Snyder wrote:

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any
problems. I have
it set up with debug so I know I’m getting as much info as I can.

Mathew,

You may be running into something that’s bitten us before - let’s say
the ticket is currently owned by “theillien” and you change the queue.
The scrip will change the owner to Nobody, then the form input is
processed. RT sees that the owner is Nobody and that the owner field on
the form is “theillien”, so it interprets this as a change from Nobody
to theillien and you end up where you started. Do you have any entries
in the ticket history showing any ownership changes?

Steve

I take it back. It would appear you are correct. I set up the scrip to log
it’s actions on this particular line of code and I’m getting:

[debug]: set owner: 814382: Owner changed from msnyder to Nobody ((eval 510):4)

However, there is no indication in the ticket that this is happening nor that it
was returned to the original value. So how can I get around this?

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

At Tuesday 8/14/2007 02:41 PM, Mathew Snyder wrote:

I take it back. It would appear you are correct. I set up the scrip to log
it’s actions on this particular line of code and I’m getting:

[debug]: set owner: 814382: Owner changed from msnyder to Nobody
((eval 510):4)

However, there is no indication in the ticket that this is happening
nor that it
was returned to the original value. So how can I get around this?

Unfortunately we haven’t found a way round this problem. What’s odd
about your situation though is that I’d expect to see history entries
recording the two owner change transactions. Sorry I can’t be more helpful…

Steve

Stephen Turner wrote:

At Tuesday 8/14/2007 02:41 PM, Mathew Snyder wrote:

I take it back. It would appear you are correct. I set up the scrip
to log
it’s actions on this particular line of code and I’m getting:

[debug]: set owner: 814382: Owner changed from msnyder to Nobody
((eval 510):4)

However, there is no indication in the ticket that this is happening
nor that it
was returned to the original value. So how can I get around this?

Unfortunately we haven’t found a way round this problem. What’s odd
about your situation though is that I’d expect to see history entries
recording the two owner change transactions. Sorry I can’t be more
helpful…

Steve

Well that sucks. :frowning:

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

Have you tried moving the scrip to from TransactionCreate to
TransactionBatch? You may have to enable it in your RT_SiteConfig…

.r’

Mathew Snyder wrote:

Robert Long wrote:

Have you tried moving the scrip to from TransactionCreate to
TransactionBatch? You may have to enable it in your RT_SiteConfig…

.r’

Mathew Snyder wrote:

Stephen Turner wrote:

At Tuesday 8/14/2007 02:41 PM, Mathew Snyder wrote:

I take it back. It would appear you are correct. I set up the scrip
to log
it’s actions on this particular line of code and I’m getting:

[debug]: set owner: 814382: Owner changed from msnyder to Nobody
((eval 510):4)

However, there is no indication in the ticket that this is happening
nor that it
was returned to the original value. So how can I get around this?

Unfortunately we haven’t found a way round this problem. What’s odd
about your situation though is that I’d expect to see history entries
recording the two owner change transactions. Sorry I can’t be more
helpful…

Steve

Well that sucks. :frowning:

Mathew

There is no TransactionCreate or TransactionBatch in my RT_SiteConfig. All I
have that is related to transactions is

Backward compatability setting. Add/Delete Link used to record one

transaction and run one scrip. Set this value to 1 if you want

only one of the link transactions to have scrips run.

Set($LinkTransactionsRun1Scrip , 0);

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com

Mathew,
I found this in the wiki, hope it helps.
http://wiki.bestpractical.com/view/TransactionBatchStage

-SeanFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Mathew
Snyder
Sent: Tuesday, August 14, 2007 3:03 PM
To: Robert Long
Cc: Stephen Turner; RT Users
Subject: Re: [rt-users] SetStatus and SetOwner scrip question

Robert Long wrote:

Have you tried moving the scrip to from TransactionCreate to
TransactionBatch? You may have to enable it in your RT_SiteConfig…

.r’

Mathew Snyder wrote:

Stephen Turner wrote:

At Tuesday 8/14/2007 02:41 PM, Mathew Snyder wrote:

I take it back. It would appear you are correct. I set up the
scrip to log it’s actions on this particular line of code and I’m
getting:

[debug]: set owner: 814382: Owner changed from msnyder to Nobody
((eval 510):4)

However, there is no indication in the ticket that this is
happening nor that it was returned to the original value. So how
can I get around this?

Unfortunately we haven’t found a way round this problem. What’s odd
about your situation though is that I’d expect to see history
entries recording the two owner change transactions. Sorry I can’t
be more helpful…

Steve

Well that sucks. :frowning:

Mathew

There is no TransactionCreate or TransactionBatch in my RT_SiteConfig.
All I have that is related to transactions is # Backward compatability
setting. Add/Delete Link used to record one # transaction and run one
scrip. Set this value to 1 if you want # only one of the link
transactions to have scrips run.
Set($LinkTransactionsRun1Scrip , 0);

Mathew
Keep up with me and what I’m up to: http://theillien.blogspot.com
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

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/email_disclaimer.jhtml].

I was looking through the list’s history.

The original email did not get an answer to it.

The piece that interests me about this listserv topic(dating back to Aug 2007)…

Sean, and myself are trying to set a ticket’s owner to nobody on an action…

He stated,

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any problems. I have
it set up with debug so I know I’m getting as much info as I can.

Can anyone tell me which of the above? and what else do I need to set to make this happen on a specific condition(I’m using On Queue change).

Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: 807.766.7331
Email: mike.johnson@normed.ca
Technology assistance: email nosmhelpdesk@normed.ca
Technology Emergency Contact (TEC) Mon-Fri, 8am to 5pm excluding stat holidays:
Off campus toll free 1-800-461-8777, option 8, or locally either
(705)-662-7120 or (807)-766-7500

I was looking through the list’s history.

The original email did not get an answer to it.

The piece that interests me about this listserv topic(dating back to Aug 2007)…

Sean, and myself are trying to set a ticket’s owner to nobody on an action…

He stated,

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any problems. I have
it set up with debug so I know I’m getting as much info as I can.

If you want as much information as possible, you should check the
return values of SetOwner. The arguments for the SetOwner method are
documented in Ticket_Overlay.pm.

-kevin

Mike,

We use this for when a ticket is moved to another Queue:

set new Ticket Owner value

my $ticket = $self->TicketObj;
$ticket->SetStatus(“new”);
$ticket->SetOwner(10, ‘Force’);
return 1;

The above code is put into the cleanup code. Hope this helps

Kenn
LBNLOn 9/24/2009 1:02 PM, Mike Johnson wrote:

I was looking through the list’s history.

The original email did not get an answer to it.

The piece that interests me about this listserv topic(dating back to
Aug 2007)…

Sean, and myself are trying to set a ticket’s owner to nobody on an
action…

He stated,

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any
problems. I have
it set up with debug so I know I’m getting as much info as I can.

Can anyone tell me which of the above? and what else do I need to set
to make this happen on a specific condition(I’m using On Queue change).

Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: 807.766.7331
Email: mike.johnson@normed.ca mailto:mike.johnson@normed.ca
Technology assistance: email nosmhelpdesk@normed.ca
mailto:nosmhelpdesk@normed.ca
Technology Emergency Contact (TEC) Mon-Fri, 8am to 5pm excluding stat
holidays:
Off campus toll free 1-800-461-8777, option 8, or locally either
(705)-662-7120 or (807)-766-7500


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

Hi Kevin,

Thx for that tidbit of info,

In that file I found the correct syntax, out of Sean’s set, the 2 below will work,

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(“10”);

But, this is baffling me…

This is my scrip

Condition: On Queue Change
Action: User Defined
Custom action Preparation Code:

set new Ticket Owner value

my $ticket = $self->TicketObj;
$ticket->SetStatus(“new”);
$ticket->SetOwner(“Nobody”);

Based on the above investigation, I know the syntax is correct for the SetOwner. However, the only thing that happens on queue change is the ticket’s status is set to new. That shows up in the ticket history. The SetOwner doesn’t show up at all, nothing happens.

This is the exact same spot Sean got stuck… and the thread ended…

Ken Crocker(thx Ken) provided the above code + 1 line (return 1;) and said his is in the cleanup code spot. If I put that code in there, absolutely nothing gets changed in the ticket…

Any thoughts anyone?

Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: 807.766.7331
Email: mike.johnson@normed.ca
Technology assistance: email nosmhelpdesk@normed.ca
Technology Emergency Contact (TEC) Mon-Fri, 8am to 5pm excluding stat holidays:
Off campus toll free 1-800-461-8777, option 8, or locally either
(705)-662-7120 or (807)-766-7500

Kevin Falcone falcone@bestpractical.com 24/09/2009 5:06 pm >>>

I was looking through the list’s history.

The original email did not get an answer to it.

The piece that interests me about this listserv topic(dating back to Aug 2007)…

Sean, and myself are trying to set a ticket’s owner to nobody on an action…

He stated,

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any problems. I have
it set up with debug so I know I’m getting as much info as I can.

If you want as much information as possible, you should check the
return values of SetOwner. The arguments for the SetOwner method are
documented in Ticket_Overlay.pm.

-kevin

Hi Kevin,

Thx for that tidbit of info,

In that file I found the correct syntax, out of Sean’s set, the 2 below will work,

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(“10”);

You’re not checking return values.

my ($status, $msg) = …
log the status and message and find out why it isn’t being set

-kevin

Mike,

You didn’t get my code correct. You forgot the “Force”. (NO, I’m NOT
saying “may the force be with you”, gaagh!).
Also, when creating a scrip, you must keep in mind that when you define
the condition as :User-Defined", you SHOULD end with a return code in
both the “Prep” & “Cleanup” areas. Since my code is in the “Cleanup”
area, I have a “return 1;” in the “Prep” area. That way RT knows to
continue on to the cleanup area. So, to re-cap, your code should look
something like this:

Condition: On whatever
Action: User-Defined

Custom Prep Code:
Return 1;

Custom Cleanup Code:

set new Ticket Owner value

my $ticket = $self->TicketObj;
$ticket->SetStatus(‘new’);
$ticket->SetOwner(10, ‘Force’);
return 1;

That should do it. Hope this helps.

Kenn
LBNLOn 9/25/2009 6:55 AM, Mike Johnson wrote:

Hi Kevin,

Thx for that tidbit of info,

In that file I found the correct syntax, out of Sean’s set, the 2
below will work,

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(“10”);

But, this is baffling me…

This is my scrip

Condition: On Queue Change
Action: User Defined
Custom action Preparation Code:

set new Ticket Owner value

my $ticket = $self->TicketObj;
$ticket->SetStatus(“new”);
$ticket->SetOwner(“Nobody”);

Based on the above investigation, I know the syntax is correct for the
SetOwner. However, the only thing that happens on queue change is the
ticket’s status is set to new. That shows up in the ticket history.
The SetOwner doesn’t show up at all, nothing happens.

This is the exact same spot Sean got stuck… and the thread ended…

Ken Crocker(thx Ken) provided the above code + 1 line (return 1;) and
said his is in the cleanup code spot. If I put that code in there,
absolutely nothing gets changed in the ticket…

Any thoughts anyone?

Mike Johnson
Datatel Programmer/Analyst
Northern Ontario School of Medicine
955 Oliver Road
Thunder Bay, ON P7B 5E1
Phone: 807.766.7331
Email: mike.johnson@normed.ca mailto:mike.johnson@normed.ca
Technology assistance: email nosmhelpdesk@normed.ca
mailto:nosmhelpdesk@normed.ca
Technology Emergency Contact (TEC) Mon-Fri, 8am to 5pm excluding stat
holidays:
Off campus toll free 1-800-461-8777, option 8, or locally either
(705)-662-7120 or (807)-766-7500

Kevin Falcone falcone@bestpractical.com 24/09/2009 5:06 pm >>>
On Thu, Sep 24, 2009 at 04:02:10PM -0400, Mike Johnson wrote:
I was looking through the list’s history.

The original email did not get an answer to it.

The piece that interests me about this listserv topic(dating back
to Aug 2007)…

Sean, and myself are trying to set a ticket’s owner to nobody on
an action…

He stated,

I’ve tried:

$self->TicketObj->SetOwner(“Nobody”);
$self->TicketObj->SetOwner(Nobody);
$self->TicketObj->SetOwner(“10”);
$self->TicketObj->SetOwner(10);
$self->TicketObj->SetOwner(Name => “Nobody”);
$self->TicketObj->SetOwner(Name => Nobody);
$self->TicketObj->SetOwner(Id => “10”);
$self->TicketObj->SetOwner(Id => 10);

None of these has worked and nothing in rt.log indicates any
problems. I have
it set up with debug so I know I’m getting as much info as I can.

If you want as much information as possible, you should check the
return values of SetOwner. The arguments for the SetOwner method are
documented in Ticket_Overlay.pm.

-kevin

Can anyone tell me which of the above? and what else do I need to
set to make this happen on a
specific condition(I’m using On Queue change).



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