Return Requestor Organization information from Dashboard "Rt at a glance" page

I want to change the listing in RT at a glance to include “requestors”, but rather than return an email address, I want it to return the requestor’s Organization. I’ve found the following: /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap.

Requestors => {
title => ‘Requestors’, # loc
attribute => ‘Requestor.EmailAddress’,
value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }

I change value to:
value => sub { return $_[0]->CreatorObj->Organization }

And this kinda works as long as the requestor created the ticket. But really it is returning the creator of the ticket. The unintended consequence is if I create a ticket on behalf of a client and then change the requestor from me to a client it still returns my organization name and not theirs.

Some guidance on getting this to work would be much appreciated.
Thanks in advance.

I want to change the listing in RT at a glance to include “requestors”, but rather than return an email address, I want it to return the requestor’s Organization. I’ve found the following: /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap.

Requestors => {
title => ‘Requestors’, # loc
attribute => ‘Requestor.EmailAddress’,
value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }

I change value to:
value => sub { return $_[0]->CreatorObj->Organization }

And this kinda works as long as the requestor created the ticket. But really it is returning the creator of the ticket. The unintended consequence is if I create a ticket on behalf of a client and then change the requestor from me to a client it still returns my organization name and not theirs.

If you are sure that there is always one requestor, then use
Requestors->UserMembersObj->First->Organization.

Else, you have to write a sub to get all Organization to display them.

Thanks for the reply back. I had tried what you suggested previously, and I tried again per your instructions, but I’m met with the following error. Either I’m calling it incorrectly or that isn’t the right command. See error below:

error: Can’t call method “Organization” on an undefined value at /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap line 176.
context:

172: Requestors => {
173: title => ‘Requestors’, # loc
174: attribute => ‘Requestor.EmailAddress’,
175: #value => sub { return $[0]->CreatorObj->Organization }
176: value => sub { return $
[0]->Requestors->UserMembersObj->First->Organization }
177: #value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
178: },
179: Cc => {
180: title => ‘Cc’, # loc

code stack: /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap:176
/opt/rt3/share/html/Elements/CollectionList:125
/opt/rt3/share/html/Elements/ShowSearch:54
/opt/rt3/share/html/Widgets/TitleBox:51
/opt/rt3/share/html/Elements/ShowSearch:55
/opt/rt3/share/html/Elements/MyRT:95
/opt/rt3/share/html/index.html:86
/opt/rt3/share/html/autohandler:311
raw error

Thanks for your help!

If you are sure that there is always one requestor, then use
Requestors->UserMembersObj->First->Organization.

As Emmanuel said, it looks like you don’t actually have requestors on
your ticket. You’ll need to write code that checks along to way to
make sure there are requestors. I bet the
MemberEmailAddressesAsString code would be an interesting place to
start.

-kevinOn Fri, Sep 17, 2010 at 05:21:02AM -0700, Shawn O’Connor wrote:

Thanks for the reply back. I had tried what you suggested previously, and I tried again per your instructions, but I’m met with the following error. Either I’m calling it incorrectly or that isn’t the right command. See error below:

error: Can’t call method “Organization” on an undefined value at /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap line 176.
context:

172: Requestors => {
173: title => ‘Requestors’, # loc
174: attribute => ‘Requestor.EmailAddress’,
175: #value => sub { return $[0]->CreatorObj->Organization }
176: value => sub { return $
[0]->Requestors->UserMembersObj->First->Organization }
177: #value => sub { return $_[0]->Requestors->MemberEmailAddressesAsString }
178: },
179: Cc => {
180: title => ‘Cc’, # loc

code stack: /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap:176
/opt/rt3/share/html/Elements/CollectionList:125
/opt/rt3/share/html/Elements/ShowSearch:54
/opt/rt3/share/html/Widgets/TitleBox:51
/opt/rt3/share/html/Elements/ShowSearch:55
/opt/rt3/share/html/Elements/MyRT:95
/opt/rt3/share/html/index.html:86
/opt/rt3/share/html/autohandler:311
raw error

Thanks for your help!

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

Thanks for the quick response. Isn’t the issue if there is more than one requestor? I would just expect maybe the wrong requestor returned in that case. Not the failure I’m seeing. I can’t imagine a scenario where I would have more than one requestor for the same ticket – unless by accident somehow. Wouldn’t you nearly always have at least one requestor? Are you saying then, that this errors out because somewhere in the list of tickets returned there is at least one ticket that does not have a requestor?

Thanks for the suggestion about “MemberEmailAddressesAsString”. I thought so too; I did play with that briefly as you may have noticed from the comment on line 177, but on this I really don’t know what I’m doing. Grasping at straws really.

Thanks again.— On Fri, 9/17/10, Kevin Falcone falcone@bestpractical.com wrote:

From: Kevin Falcone falcone@bestpractical.com
Subject: Re: [rt-users] Return Requestor Organization information from Dashboard “Rt at a glance” page
To: rt-users@lists.bestpractical.com
Date: Friday, September 17, 2010, 7:44 AM
On Thu, Sep 16, 2010 at 10:32:49PM +0200, Emmanuel Lacour wrote:

If you are sure that there is always one requestor,
then use

Requestors->UserMembersObj->First->Organization.

As Emmanuel said, it looks like you don’t actually have
requestors on
your ticket. You’ll need to write code that checks
along to way to
make sure there are requestors. I bet the
MemberEmailAddressesAsString code would be an interesting
place to
start.

-kevin

On Fri, Sep 17, 2010 at 05:21:02AM -0700, Shawn O’Connor wrote:

Thanks for the reply back. I had tried what you
suggested previously, and I tried again per your
instructions, but I’m met with the following error.
Either I’m calling it incorrectly or that isn’t the right
command. See error below:

error: Can’t call
method “Organization” on an undefined value at
/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap line 176.
context:

172: Requestors => {
173: title =>
‘Requestors’, # loc
174: attribute =>
‘Requestor.EmailAddress’,
175: #value => sub {
return $[0]->CreatorObj->Organization }
176: value => sub { return
$
[0]->Requestors->UserMembersObj->First->Organization
}
177: #value => sub {
return $_[0]->Requestors->MemberEmailAddressesAsString
}
178: },
179: Cc => {
180: title => ‘Cc’, # loc

code stack:
/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap:176
/opt/rt3/share/html/Elements/CollectionList:125
/opt/rt3/share/html/Elements/ShowSearch:54
/opt/rt3/share/html/Widgets/TitleBox:51
/opt/rt3/share/html/Elements/ShowSearch:55
/opt/rt3/share/html/Elements/MyRT:95
/opt/rt3/share/html/index.html:86
/opt/rt3/share/html/autohandler:311
raw error

Thanks for your help!

RT Training in Washington DC, USA on Oct 25 & 26
2010
Last one this year – Learn how to get the most out of
RT!

-----Inline Attachment Follows-----

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of
RT!

Thanks for the quick response. Isn’t the issue if there is more
than one requestor? I would just expect maybe the wrong requestor

If First is returning undef, then you have no requestors.
If you had 3 requestors, it would return the first one.
If you want all of them, you have to loop, which is why I pointed out
the MemberEmailAddressesAsString method

-kevin

Your advice helped me along in the right direction. All of my tickets did have a requestor, BUT a few were from an employee that is no longer with us whose account had been disabled in RT – so a ticket input by that person showed up as having “no requestor”. Once I re-activated that person’s account the function you suggested worked! Thanks.

So that begs the question – is there some parameter I can pass that can capture that exception and either ignore that the account has been disabled or perhaps return a default value instead of blowing up?

Thanks again.— On Fri, 9/17/10, Kevin Falcone falcone@bestpractical.com wrote:

From: Kevin Falcone falcone@bestpractical.com
Subject: Re: [rt-users] Return Requestor Organization information from Dashboard “Rt at a glance” page
To: rt-users@lists.bestpractical.com
Date: Friday, September 17, 2010, 8:37 AM
On Fri, Sep 17, 2010 at 06:29:21AM 0700, Shawn O’Connor wrote:

Thanks for the quick response. Isn’t the issue
if there is more
than one requestor? I would just expect maybe
the wrong requestor

If First is returning undef, then you have no requestors.
If you had 3 requestors, it would return the first one.
If you want all of them, you have to loop, which is why I
pointed out
the MemberEmailAddressesAsString method

-kevin

returned in that case. Not the failure I’m
seeing. I can’t imagine
a scenario where I would have more than one requestor
for the same
ticket – unless by accident somehow. Wouldn’t
you nearly always
have at least one requestor? Are you saying
then, that this errors
out because somewhere in the list of tickets returned
there is at
least one ticket that does not have a requestor?

Thanks for the suggestion about
"MemberEmailAddressesAsString". I thought so too; I
did play with that briefly as you may have noticed from the
comment on line 177, but on this I really don’t know what
I’m doing. Grasping at straws really.

Thanks again.

— On Fri, 9/17/10, Kevin Falcone falcone@bestpractical.com wrote:

From: Kevin Falcone falcone@bestpractical.com
Subject: Re: [rt-users] Return Requestor
Organization information from Dashboard "Rt at a glance"
page

To: rt-users@lists.bestpractical.com
Date: Friday, September 17, 2010, 7:44 AM
On Thu, Sep 16, 2010 at 10:32:49PM +0200, Emmanuel Lacour wrote:

If you are sure that there is always one
requestor,

then use

Requestors->UserMembersObj->First->Organization.

As Emmanuel said, it looks like you don’t
actually have

requestors on
your ticket. You’ll need to write code that
checks

along to way to
make sure there are requestors. I bet the
MemberEmailAddressesAsString code would be an
interesting

place to
start.

-kevin

On Fri, Sep 17, 2010 at 05:21:02AM -0700, Shawn O’Connor wrote:

Thanks for the reply back. I had tried
what you

suggested previously, and I tried again per your
instructions, but I’m met with the following
error.

Either I’m calling it incorrectly or that isn’t
the right

command. See error below:

error: Can’t call
method “Organization” on an undefined value at
/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap
line 176.

context:

172: Requestors => {
173: title =>
‘Requestors’, # loc
174: attribute =>
‘Requestor.EmailAddress’,
175: #value => sub {
return $_[0]->CreatorObj->Organization }
176: value => sub { return

$_[0]->Requestors->UserMembersObj->First->Organization

}

177: #value => sub {
return
$_[0]->Requestors->MemberEmailAddressesAsString

}

178: },
179: Cc => {
180: title => ‘Cc’, # loc

code stack:

/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap:176

/opt/rt3/share/html/Elements/CollectionList:125

/opt/rt3/share/html/Elements/ShowSearch:54
/opt/rt3/share/html/Widgets/TitleBox:51
/opt/rt3/share/html/Elements/ShowSearch:55
/opt/rt3/share/html/Elements/MyRT:95
/opt/rt3/share/html/index.html:86
/opt/rt3/share/html/autohandler:311
raw error

Thanks for your help!

RT Training in Washington DC, USA on Oct 25
& 26

2010

Last one this year – Learn how to get the
most out of

RT!

-----Inline Attachment Follows-----

RT Training in Washington DC, USA on Oct 25 &
26 2010

Last one this year – Learn how to get the most
out of

RT!

RT Training in Washington DC, USA on Oct 25 & 26
2010
Last one this year – Learn how to get the most out of
RT!

-----Inline Attachment Follows-----

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of
RT!

Your advice helped me along in the right direction. All of my tickets did have a requestor, BUT a few were from an employee that is no longer with us whose account had been disabled in RT – so a ticket input by that person showed up as having “no requestor”. Once I re-activated that person’s account the function you suggested worked! Thanks.

So that begs the question – is there some parameter I can pass that can capture that exception and either ignore that the account has been disabled or perhaps return a default value instead of blowing up?

Yes, you can write a loop, similar to what
MemberEmailAddressesAsString does internally.

-kevin> — On Fri, 9/17/10, Kevin Falcone falcone@bestpractical.com wrote:

From: Kevin Falcone falcone@bestpractical.com
Subject: Re: [rt-users] Return Requestor Organization information from Dashboard “Rt at a glance” page
To: rt-users@lists.bestpractical.com
Date: Friday, September 17, 2010, 8:37 AM
On Fri, Sep 17, 2010 at 06:29:21AM 0700, Shawn O’Connor wrote:

Thanks for the quick response. Isn’t the issue
if there is more
than one requestor? I would just expect maybe
the wrong requestor

If First is returning undef, then you have no requestors.
If you had 3 requestors, it would return the first one.
If you want all of them, you have to loop, which is why I
pointed out
the MemberEmailAddressesAsString method

-kevin

returned in that case. Not the failure I’m
seeing. I can’t imagine
a scenario where I would have more than one requestor
for the same
ticket – unless by accident somehow. Wouldn’t
you nearly always
have at least one requestor? Are you saying
then, that this errors
out because somewhere in the list of tickets returned
there is at
least one ticket that does not have a requestor?

Thanks for the suggestion about
"MemberEmailAddressesAsString". I thought so too; I
did play with that briefly as you may have noticed from the
comment on line 177, but on this I really don’t know what
I’m doing. Grasping at straws really.

Thanks again.

— On Fri, 9/17/10, Kevin Falcone falcone@bestpractical.com wrote:

From: Kevin Falcone falcone@bestpractical.com
Subject: Re: [rt-users] Return Requestor
Organization information from Dashboard "Rt at a glance"
page

To: rt-users@lists.bestpractical.com
Date: Friday, September 17, 2010, 7:44 AM
On Thu, Sep 16, 2010 at 10:32:49PM +0200, Emmanuel Lacour wrote:

If you are sure that there is always one
requestor,

then use

Requestors->UserMembersObj->First->Organization.

As Emmanuel said, it looks like you don’t
actually have

requestors on
your ticket. You’ll need to write code that
checks

along to way to
make sure there are requestors. I bet the
MemberEmailAddressesAsString code would be an
interesting

place to
start.

-kevin

On Fri, Sep 17, 2010 at 05:21:02AM -0700, Shawn O’Connor wrote:

Thanks for the reply back. I had tried
what you

suggested previously, and I tried again per your
instructions, but I’m met with the following
error.

Either I’m calling it incorrectly or that isn’t
the right

command. See error below:

error: Can’t call
method “Organization” on an undefined value at
/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap
line 176.

context:

172: Requestors => {
173: title =>
‘Requestors’, # loc
174: attribute =>
‘Requestor.EmailAddress’,
175: #value => sub {
return $_[0]->CreatorObj->Organization }
176: value => sub { return

$_[0]->Requestors->UserMembersObj->First->Organization

}

177: #value => sub {
return
$_[0]->Requestors->MemberEmailAddressesAsString

}

178: },
179: Cc => {
180: title => ‘Cc’, # loc

code stack:

/opt/rt3/share/html/Elements/RT__Ticket/ColumnMap:176

/opt/rt3/share/html/Elements/CollectionList:125

/opt/rt3/share/html/Elements/ShowSearch:54
/opt/rt3/share/html/Widgets/TitleBox:51
/opt/rt3/share/html/Elements/ShowSearch:55
/opt/rt3/share/html/Elements/MyRT:95
/opt/rt3/share/html/index.html:86
/opt/rt3/share/html/autohandler:311
raw error

Thanks for your help!

RT Training in Washington DC, USA on Oct 25
& 26

2010

Last one this year – Learn how to get the
most out of

RT!

-----Inline Attachment Follows-----

RT Training in Washington DC, USA on Oct 25 &
26 2010

Last one this year – Learn how to get the most
out of

RT!

RT Training in Washington DC, USA on Oct 25 & 26
2010
Last one this year – Learn how to get the most out of
RT!

-----Inline Attachment Follows-----

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of
RT!

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!