[rt-users] Return Requestor Organization information from Dashboard "Rt at a glance" page

Kevin Falcone falcone at bestpractical.com
Fri Sep 17 16:06:50 EDT 2010


On Fri, Sep 17, 2010 at 10:21:07AM -0700, Shawn O'Connor wrote:
> 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 at bestpractical.com> wrote:
> 
> > From: Kevin Falcone <falcone at bestpractical.com>
> > Subject: Re: [rt-users] Return Requestor Organization information from Dashboard "Rt at a glance" page
> > To: rt-users at 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 at bestpractical.com>
> > wrote:
> > > 
> > > > From: Kevin Falcone <falcone at bestpractical.com>
> > > > Subject: Re: [rt-users] Return Requestor
> > Organization information from Dashboard "Rt at a glance"
> > page
> > > > To: rt-users at 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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100917/13f082c8/attachment.sig>


More information about the rt-users mailing list