[rt-users] Allowing user to provide a required CF at resolve time

2011-07-13 Thread Francis L Fabrizio
We have a CF named 'ServiceTag' and we want to ensure a value is provided 
before a ticket can be resolved.

Here's what we already have working:

1.   We created a Callback on Update.html which checks whether the user is 
a. trying to resolve and b. has provided a service tag.  If not, we do not 
allow the resolve to proceed, and the user gets the message Sorry, can't 
resolve ticket without a service tag. at the top of the form.

2.   We've copied Update.html to local/ and added a Service Tag form field 
on the page.  If the service tag is already defined, this field populates the 
value correctly.

So far so good.  What I haven't quite figured out how to do is to capture the 
new value if the user provides one.

Of course, the common case we are trying to handle is when the user attempts to 
resolve a ticket that has no service tag.  So they click Resolve on the ticket, 
type in some message, and then they click Update Ticket the first time and get 
the message Sorry, can't resolve ticket without a service tag.  We now want 
to allow them to simply provide the service tag on the form, and click Update 
Ticket again, and then we want to store the service tag and allow the resolve 
to proceed.

I'm guessing I need to do something in Update.html's INIT area to detect 
whether the ServiceTag value has changed, but I am not quite sure how to 
proceed.  Can anyone provide some pointers?

Thanks,
Fran


2011 Training: http://bestpractical.com/services/training.html

[rt-users] Adding a predefined search field

2011-05-20 Thread Francis L Fabrizio
There's a particular search we do constantly against our custom field PO 
Number.  Since the custom field is only applied to certain queues, building 
the search is a two-step process of first adding the Queue is XYZ search term 
which then gives us visibility to add the PO Number search term.

It's not uncommon to need to do 20 or 30 such searches in rapid succession.  
This gets tedious because you have to Edit Search, delete the old value, add 
the new value, and repeat 30 times.

What I'd really like is a search field in the upper bar (separate from the 
existing one) which automatically does a search queue XYZ for tickets with PO 
Number value of whatever is input in the field search.  That would avoid all 
of these tedious steps.

What's the best way to go about adding such functionality to our RT 3.8 
interface?

--
Fran Fabrizio
Director of Information Systems
UAB College of Arts and Sciences
http://www.uab.edu/cas/
HHB510E | 205.996.5698 | fabri...@uab.edumailto:fabri...@uab.edu



Re: [rt-users] Adding a predefined search field

2011-05-20 Thread Francis L Fabrizio
I just installed RTx::Tags to get the enhanced simple search custom field 
functionality without having to patch code.  Thanks for the suggestion!

Works great except RTx::Tags seems to have broken my layout in the upper right 
of the page.  See the attached image - the New Ticket queue dropdown got moved 
under the Search button for some reason.  (This is RT 3.8.8 / Firefox 3.6.17 / 
64-bit Win7.)


 -Original Message-
 From: ruslan.zaki...@gmail.com [mailto:ruslan.zaki...@gmail.com] On
 Behalf Of Ruslan Zakirov
 Sent: Friday, May 20, 2011 9:47 AM
 To: Francis L Fabrizio
 Cc: rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Adding a predefined search field
 
 On Fri, May 20, 2011 at 6:22 PM, Francis L Fabrizio fabri...@uab.edu wrote:
  There’s a particular search we do constantly against our custom field “PO
  Number”.  Since the custom field is only applied to certain queues, building
  the search is a two-step process of first adding the “Queue is XYZ” search
  term which then gives us visibility to add the PO Number search term.
 
 
 
  It’s not uncommon to need to do 20 or 30 such searches in rapid
 succession.
  This gets tedious because you have to Edit Search, delete the old value,
 add
  the new value, and repeat 30 times.
 
 
 
  What I’d really like is a search field in the upper bar (separate from the
  existing one) which automatically does a “search queue XYZ for tickets with
  PO Number value of whatever is input in the field” search.  That would
  avoid all of these tedious steps.
 
 
 
  What’s the best way to go about adding such functionality to our RT 3.8
  interface?
 
 
 One way:
 http://requesttracker.wikia.com/wiki/SearchCustomField
 
 This solution shows how to enable the following syntax in the search input
 box:
 
 cf.xxx:value
 
 You just should adjust it a little and your users can type:
 
 po:123
 
 and perform the search.
 
  --
 
  Fran Fabrizio
 
  Director of Information Systems
 
  UAB College of Arts and Sciences
 
  http://www.uab.edu/cas/
 
  HHB510E | 205.996.5698 | fabri...@uab.edu
 
 
 
 
 
 --
 Best regards, Ruslan.
attachment: NewTicketDropdownBrokenLayout.png

Re: [rt-users] Tracking down rogue dashboard subscriptions

2010-12-20 Thread Francis L Fabrizio
I ran the following command (figured out you meant --epoch, not --time  :-)

# /usr/local/rt/sbin/rt-email-dashboards --debug --epoch 1292849980
Using time Mon Dec 20 06:59:40 2010
Sending email from helpd...@cas.uab.edu
[snip other users]
Checking fabrizio's subscriptions: hour 06:00, dow Monday, dom 20
Checking against subscription with frequency never, hour 06:00, dow Monday, dom 
1
[snip other users]
#

I could not trick it into sending the subscription.  However, it did send it to 
me at 6am this morning, as it has been every morning.

I notice that the debug output seems to think the subscription is only for dom 
1.  Yet I still get it every morning.

-Fran


Re: [rt-users] Tracking down rogue dashboard subscriptions

2010-12-17 Thread Francis L Fabrizio
To first answer Kevin's question, yep that's the only record that is returned 
when doing select * from Attributes where Name = 'Subscription';

The crontab entry is:

0 * * * * /usr/local/rt/sbin/rt-email-dashboards

Thanks,
Fran

 -Original Message-
 From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-
 boun...@lists.bestpractical.com] On Behalf Of Shawn M Moore
 Sent: Thursday, December 16, 2010 11:20 AM
 To: rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Tracking down rogue dashboard subscriptions
 
 On 10/12/16 11:29, Francis L Fabrizio wrote:
  Content of attribute #91: $VAR1 = {
 'ContentType' =  'storable',
 'Content' =  {
'Frequency' =  'never',
'Recipient' =  '',
'DashboardId' =  '70',
'Hour' =  '06:00',
'Dom' =  '1',
'Rows' =  '0',
'Fow' =  '1',
'Counter' =  24,
'Dow' =  'Monday'
  },
 'Description' =  'Subscription to dashboard 70',
 'Name' =  'Subscription',
 'ObjectId' =  '52',
 'ObjectType' =  'RT::User'
   };
 
 That looks correct, rt-email-dashboards should be skipping the
 subscription if the frequency is never. Hm. Can you produce the
 crontab entry for rt-email-dashboards? Perhaps it mistakenly has --all
 in its options, which always issues mail for dashboard subscriptions
 regardless of their frequency.
 
 Shawn


[rt-users] Tracking down rogue dashboard subscriptions

2010-12-16 Thread Francis L Fabrizio
I have been trying to track down why I am still getting subscription emails for 
a dashboard for which I thought I had disabled my subscription.  

When I go to Tools - Dashboards, there is a dashboard defined at the group 
level for a group that I belong to.  Previously, I was subscribed to this 
dashboard daily at 6am.  I since went back in to try to disable it, and the 
subscription column now reads None.  I click on None and it shows that the 
subscription frequency is never.  Yet, I still get the subscription email 
every morning at 6am as it was previously set to do.

Our RT 3.8.8 install has only this one dashboard defined.  I did some exploring 
directly in the database, and in the Attributes table there is only one row for 
a subscription, and when I resubmit the never frequency for this 
subscription, that row gets hit (lastUpdated becomes current time).  Yet, I am 
still getting the email.

Is this a bug, or is there some other way to subscribe to dashboards that I 
need to disable?  What would happen if I simply delete this row from the DB 
(seems like a bad idea, but might work)?

--
Fran Fabrizio
Director of Information Systems
UAB College of Arts and Sciences
HHB560C | 205.996.5698 | fabri...@uab.edu




Re: [rt-users] Tracking down rogue dashboard subscriptions

2010-12-16 Thread Francis L Fabrizio
 use sbin/rt-attributes-viewer to look at that attribute record and see
 what is in it.

Just as an aside, that script wasn't in my 3.8.8 install. (Probably related to: 
http://www.mail-archive.com/rt-users@lists.bestpractical.com/msg26778.html)  
Grabbed a fresh tarball to get it and ran it.  

Content of attribute #91: $VAR1 = {
  'ContentType' = 'storable',
  'Content' = {
 'Frequency' = 'never',
 'Recipient' = '',
 'DashboardId' = '70',
 'Hour' = '06:00',
 'Dom' = '1',
 'Rows' = '0',
 'Fow' = '1',
 'Counter' = 24,
 'Dow' = 'Monday'
   },
  'Description' = 'Subscription to dashboard 70',
  'Name' = 'Subscription',
  'ObjectId' = '52',
  'ObjectType' = 'RT::User'
};



[rt-users] Templates and custom ScripActions

2010-10-22 Thread Francis L Fabrizio
Do I have to do something specific when creating a Scrip and using Action: User 
Defined in order to get RT to process the associated template with the scrip? 

I have created a custom scrip, and just for testing purposes, I made the custom 
condition, custom action prep, and custom action cleanup all set to return 
1;, and associated my desired template with the scrip.  The scrip fires and 
returns successfully, but the template is never touched.  

Are there specific steps I need to take in my custom action code in order to 
load, parse, and send notifications from a template?

Thanks,
Fran




Re: [rt-users] Templates and custom ScripActions

2010-10-22 Thread Francis L Fabrizio
Gene,

I wouldn't mind embedding the logic in the template, in fact I tried that at 
first, but my decision making requires that I have access to 
$self-TransactionObj-NewValue from my CustomField.  I couldn't seem to get at 
this from the template itself.  I had trouble finding the right magic to access 
the Transaction's NewValue.  

I've seen code samples that use $Transaction within templates, but 
$Transaction-NewValue seems undef.  Are you aware of how I could get at 
NewValue?  
Or perhaps as an alternative, a way to populate a variable in the Custom 
Condition that would then be accessible from the Template?  I'm sort of 
grasping at straws, but hoping that somehow I can get the Template to see the 
NewValue of my CustomField.  Once I have that, I can retrieve the email listing 
of users from the appropriate RT group and the rest is easy, and I would not 
need any user-defined action at that point.

Thanks,
Fran


 -Original Message-
 From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-
 boun...@lists.bestpractical.com] On Behalf Of Gene LeDuc
 Sent: Friday, October 22, 2010 11:34 AM
 To: rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Templates and custom ScripActions
 
 Hi Fran,
 
 On 10/22/2010 8:15 AM, Francis L Fabrizio wrote:
  Do I have to do something specific when creating a Scrip and using
 Action: User Defined in order to get RT to process the associated
 template with the scrip?
 
  I have created a custom scrip, and just for testing purposes, I made
 the custom condition, custom action prep, and custom action cleanup all
 set to return 1;, and associated my desired template with the scrip.
 The scrip fires and returns successfully, but the template is never
 touched.
 
  Are there specific steps I need to take in my custom action code in
 order to load, parse, and send notifications from a template?
 
  Thanks,
  Fran
 
 I'm using v3.6.3, so this may not be accurate with your setup.
 
 I know of ways to do what you want.
 
 The way I prefer to do it is to embed the code into the template.  I've
 found this to be fairly easy to do and it involves less code.  It can
 also be trickier to debug because the scrip doesn't tell you what
 action
 is being taken - it's all in the template.  It does make the template
 bigger.  Almost all of my templates have embedded decision-making and
 data-processing routines in them.  Here's a piece of one of my
 templates
 that builds a custom acknowledgment e-mail.
 
 = BEGIN TEMPLATE CODE
 { ### Tells user that ticket has been resolved
my $FromAddress = 'DNS Requests someaddr...@domain';
my $ContactAddress = 'm...@domain';
my $OwnerName = $Ticket-OwnerObj-RealName;
my $have_rmks;
my $c_content;
 
### Get last Correspond
my $Transactions = $Ticket-Transactions;
$Transactions-Limit( FIELD = 'Type', VALUE = 'Correspond' );
$Transactions-OrderByCols (
   { FIELD = 'Created',  ORDER = 'DESC' },
   { FIELD = 'id', ORDER = 'DESC' },
);
my $CorrespondObj = $Transactions-First;
if ($CorrespondObj  $CorrespondObj-Id) {
  $c_content = $CorrespondObj-Content;
  chomp $c_content;
  $have_rmks =
 !$CorrespondObj-Attachments-First-GetHeader('Received');
}
 ### Lots of other code removed
my $AddressGroup = From: $FromAddress;
$AddressGroup .= \nCc: $Cc if $Cc;
$AddressGroup .= \nBcc: $Bcc if $Bcc;
$OUT = $AddressGroup
 Subject: Action completed
 
 The ticket that was opened for your request for host \$mName\ has
 been
 resolved by $OwnerName.  If you have any questions about this, you can
 contact us at $ContactAddress.
 $remarks
 
 Regards,
 Your Friendly IT Staff;
 }
 = END TEMPLATE CODE
 
 Another way to do this that actually uses a user-defined action with a
 template is to make the calls to the appropriate RT routines from
 within
 your scrip code.  I did this with one of my scrips.
 
 I wanted to do some non-standard things with the recipients, so I
 modified RT's SetRecipients() routine and stuck it into my scrip, then
 I
 call it and make calls to the Prepare() and Commit() routines to build
 and send an e-mail using the designated template.
 
 = BEGIN SCRIP CODE
 ### Valid e-mail for ticket, send acknowledgment
 $self-SetRecipients();
 $self-SUPER::Prepare();
 $self-SUPER::Commit();
 
 sub SetRecipients {
### custom routine to do non-standard things with the recipients
 }
 1;
 = END SCRIP CODE
 
 The above code snippet is at the end of my scrip's Custom action
 preparation code block.
 
 Regards,
 Gene


Re: [rt-users] Report on time worked per user

2010-09-07 Thread Francis L Fabrizio
Yes, the TimeWorkedReport does have the option to show time worked per user per 
ticket.  I can't remember if I coded it to be the default presentation or not, 
but it's documented on that wiki page IIRC.

-Fran

 -Original Message-
 From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-
 boun...@lists.bestpractical.com] On Behalf Of Johan Sjöberg
 Sent: Thursday, September 02, 2010 3:57 PM
 To: rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Report on time worked per user
 
 I think that this is what you want.
 
 http://wiki.bestpractical.com/view/TimeWorkedReport
 
 /Johan
 
 -Original Message-
 From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-
 boun...@lists.bestpractical.com] On Behalf Of Ian Rowland
 Sent: den 2 september 2010 22:45
 To: rt-users@lists.bestpractical.com
 Subject: [rt-users] Report on time worked per user
 
 Hi folks
 
 I'd like to pull a report on time worked per user on a ticket, at
 present I am pulling a report on resolved, then go into each ticket to
 see how much time was spent per user on a ticket.
 
 Is there a way to report on time spent per user on a ticket?
 
 Example:
 
 Ticket ID   Subject Total Time SpentTime User A Time User B
 etc
 2223 Ian cannot print   30  15 15 etc
 
 
 
 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!

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


Re: [rt-users] Requiring CF to be defined on resolve

2010-08-26 Thread Francis L Fabrizio
 exposing check_failure in a callback is a good idea. Can you provide a
 patch for this so it will go in RT core?

This simple patch was sufficient for me:


--- /usr/local/rt/local/html/Ticket/Update.html 2010-08-26 08:25:06.0 
-0500
+++ /usr/local/rt/share/html/Ticket/Update.html 2010-08-24 08:33:38.0 
-0500
@@ -168,7 +168,7 @@

 my @results;

-$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, checks_failure = 
\$checks_failure, results = \...@results, CallbackName = 'Initial' );
+$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, results = 
\...@results, CallbackName = 'Initial' );

 unless($DefaultStatus){
 $DefaultStatus=($ARGS{'Status'} ||$TicketObj-Status());


It might make sense to also expose checks_failure in other callbacks in 
Update.html, but hooking in at Initial seems pretty flexible on its own.

-Fran

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


Re: [rt-users] Requiring CF to be defined on resolve

2010-08-26 Thread Francis L Fabrizio
Sorry, I created that patch pre-coffee this morning, and the patch was going 
backwards.  Here's the real patch:

--- /usr/local/rt/share/html/Ticket/Update.html 2010-08-24 08:33:38.0 
-0500
+++ /usr/local/rt/local/html/Ticket/Update.html 2010-08-26 08:25:06.0 
-0500
@@ -168,7 +168,7 @@

 my @results;

-$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, results = 
\...@results, CallbackName = 'Initial' );
+$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, checks_failure = 
\$checks_failure, results = \...@results, CallbackName = 'Initial' );

 unless($DefaultStatus){
 $DefaultStatus=($ARGS{'Status'} ||$TicketObj-Status());




 -Original Message-
 From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-
 boun...@lists.bestpractical.com] On Behalf Of Francis L Fabrizio
 Sent: Thursday, August 26, 2010 8:37 AM
 To: Emmanuel Lacour; rt-users@lists.bestpractical.com
 Subject: Re: [rt-users] Requiring CF to be defined on resolve
 
  exposing check_failure in a callback is a good idea. Can you provide
 a
  patch for this so it will go in RT core?
 
 This simple patch was sufficient for me:
 
 
 --- /usr/local/rt/local/html/Ticket/Update.html 2010-08-26
 08:25:06.0 -0500
 +++ /usr/local/rt/share/html/Ticket/Update.html 2010-08-24
 08:33:38.0 -0500
 @@ -168,7 +168,7 @@
 
  my @results;
 
 -$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, checks_failure
 = \$checks_failure, results = \...@results, CallbackName = 'Initial' );
 +$m-callback( Ticket = $TicketObj, ARGSRef = \%ARGS, results =
 \...@results, CallbackName = 'Initial' );
 
  unless($DefaultStatus){
  $DefaultStatus=($ARGS{'Status'} ||$TicketObj-Status());
 
 
 It might make sense to also expose checks_failure in other callbacks in
 Update.html, but hooking in at Initial seems pretty flexible on its
 own.
 
 -Fran
 
 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!


Re: [rt-users] Requiring CF to be defined on resolve

2010-08-23 Thread Francis L Fabrizio

 In Ticket/Update.html, you should look at code that call
 /Elements/ValidateCustomFields and do something like this. (i.e. set
 check_failure=1; and add you're message to @results (which will be
 displayed to user using /Elements/ListActions like every
 information/error messages in RT)).

Great, thanks, that looks very helpful.  Can you access @results from a 
ScripAction?  I've read elsewhere that it's not possible.  Can you access the 
$m HTML::Mason request or HTML::Mason components from a ScripAction? 

Thanks,
Fran


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


Re: [rt-users] Requiring CF to be defined on resolve

2010-08-23 Thread Francis L Fabrizio
 
 In Ticket/Update.html, you should look at code that call
 /Elements/ValidateCustomFields and do something like this. (i.e. set
 check_failure=1;

Looked at this for a couple more hours this afternoon and decided to abandon 
the ScripAction approach and try to accomplish this via callback instead.  
Unfortunately, the checks_failure variable is not exposed to any of the 
callbacks in Update.html like it is in Create.html.  That appears to make it 
very difficult to cause a ticket update to fail from a callback.  Is overlaying 
the entire Update.html file the only way to accomplish this?  Was trying to 
avoid that and the resulting headaches with future upgrades if possible.  Any 
ideas?

Thanks,
Fran

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-users] Requiring CF to be defined on resolve

2010-08-21 Thread Francis L Fabrizio
I want to check that a certain custom field is defined when a user tries to 
resolve a ticket.  If it is not defined, I don't want to allow the resolve to 
proceed, and I want to show a status message to the user letting them know that 
the resolve failed because they need to provide a value for this custom field.

I can detect whether the CF has a value, but I can't figure out how to prevent 
the resolve or display a message to the user in the Results area.  I did figure 
out that I could just set status back to open in my scrip action, but 
unfortunately the Results area still reads Status set from open to resolved 
even though the ticket is still open, because the initiating transaction was 
open - resolved.  I cannot figure out how to write into that Results area at 
all to let the user know the resolve did not work.

Is there any way to abort the attempted resolve transaction if the CF is 
undefined and leave a message for the user saying why?

Thanks,
Fran

--
Fran Fabrizio
Director of Information Systems
UAB College of Arts and Sciences
HHB560C | 205.996.5698 | fabri...@uab.edu



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