[rt-users] Mandatory Time Worked Field on Ticket Updates

Kenneth Crocker kfcrocker at lbl.gov
Tue Mar 15 14:12:27 EDT 2011


Christian,

Sure. The first one checks for TimeWorked when the ticket is resolved. If no
TImeWorked, it sets the status to "Stalled" and sets a CF Value in order to
trigger an email notification:

Scrip1 - Check for TimeWorked:
Condition: On Resolve
Action: user-Defined
Template: Global template: Blank
Stage: TransactionBatch

Custom Action Prep Code:
# Set initial values

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $cf_obj = new RT::CustomField($RT::SystemUser);
my $timeworked = $ticket->TimeWorked;

# Set value for CF "Work-State" if TimeWorked not set

my $cf_name = "Work-State";
my $cf_value = "TIME WORKED NOT SET";

unless ($timeworked)
    {
     $cf_obj->LoadByName(Name=>$cf_name);
     $RT::Logger->debug("Loaded\$cf_obj->Name = ". $cf_obj->Name() ."\n" );
     $ticket->AddCustomFieldValue( Field=>$cf_obj, Value=>$cf_value,
RecordTransaction=>0 );
     $ticket->SetStatus("stalled");
    }
return 1;

Custom Action Cleanup Code:
return 1;

Of course, you might want to change the condition to "User-Defined" and code
up your trigger.
Then, there is the Email notification that the ticket owner didn't set
TimeWorked in his ticket:
I had to add a new type of Action called "AutoReply to Owner" so I could use
it.

Scrip 2 - "Notify Owner on No Time"
Condition: User-Defined
Action: AutoReply to Owner
Template: Global template: Owner Time not Set
Stage: TransactionBatch

Custom Condition Code:

# Set initial values

my $trans = $self->TransactionObj;
my $ticket = $self->TicketObj;
my $state = $ticket->FirstCustomFieldValue('Work-State');

# Check for trans status of "stalled" and the CF "Work-State"
# for "TIME WORKED NOT SET"

return ($trans->Type eq "Status" &&
          $trans->NewValue eq "stalled" &&
          $state eq "TIME WORKED NOT SET");

That's it. The reason I had to add the new "AutoReply to Owner" is because I
have my configuration set for "NotifyActor, 0". So, the owner is the actor
and he wouldn't get an email when he did that transaction. I believe the RT
Essentials has instructions on this, but if you get confused, let me know
and I'll send you step by step instructions.

Lot's of luck.

Kenn
LBNL

On Tue, Mar 15, 2011 at 9:37 AM, Pena, Christian <
Christian.Pena at corp.earthlink.com> wrote:

> Then that would be great. Can you send me an example of your scrip?
>
>
>
> *Christian Pena*
> Network Engineer Supervisor
> *EarthLink Business*
>
> *E: *christian.pena at corp.earthlink.com
> *O:* 786-363-0460 | *F:* 786-363-0206
> *STS Telecom is now EarthLink Business*
>
>
>
> *From:* rt-users-bounces at lists.bestpractical.com [mailto:
> rt-users-bounces at lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
> *Sent:* Tuesday, March 15, 2011 12:31 PM
>
> *To:* rt-users at lists.bestpractical.com
> *Subject:* Re: [rt-users] Mandatory Time Worked Field on Ticket Updates
>
>
>
> Christian,
>
> The option I offered you can certainly be modified for a different
> condition (like "On Transaction", or if the value of some other field is
> modified, etc.). You just have to decide what condition (simple or complex)
> you want. I'll help you if you want.
>
> Kenn
> LBNL
>
> On Tue, Mar 15, 2011 at 9:27 AM, Pena, Christian <
> Christian.Pena at corp.earthlink.com> wrote:
>
> We use RT for supporting customers and often times there are multiple phone
> calls on a single RT case. So simply forcing time Worked on Resolution is
> not what I am looking for.
>
>
> I am trying to track how long each person is taking supporting different
> things. I have tried to mandate people to update the Worked field on every
> update, but I think I need a to whip them harder or code a better solution
> J
>
>
>
> *Christian Pena*
> Network Engineer Supervisor
> *EarthLink Business*
>
> *E: *christian.pena at corp.earthlink.com
> *O:* <786-363-0460>786-363-0460 | *F:* <786-363-0206>786-363-0206
> *STS Telecom is now EarthLink Business*
>
>
>
> *From:* rt-users-bounces at lists.bestpractical.com [mailto:
> rt-users-bounces at lists.bestpractical.com] *On Behalf Of *Kenneth Crocker
> *Sent:* Tuesday, March 15, 2011 12:04 PM
> *To:* rt-users at lists.bestpractical.com
> *Subject:* Re: [rt-users] Mandatory Time Worked Field on Ticket Updates
>
>
>
> Christian,
>
> I couldn't find an easy way to do this without a lot of mods to the RT code
> (which I'm REAL BAD at as a beginner in perl), so I wrote a scrip
> "work-around". If someone tries to resolve a ticket without any TimeWorked,
> I re-set the status to "Stalled" and send them an email telling them what I
> did and why. I also set a CF to a value I use for the email notification.
> Let me know if that's the way you want to go.
>
> Kenn
> LBNL
>
> On Tue, Mar 15, 2011 at 5:46 AM, Pena, Christian <
> Christian.Pena at corp.earthlink.com> wrote:
>
> This is something that has probably been asked on the lists many time so
> bear with me.
>
>
>
> I want to make the “Worked” field mandatory on every ticket update. I read
> references on the need to do Call Backs but not sure what Syntax to use to
> achieve this. Can anyone point me in the right direction?
>
>
>
> Thanks!
>
>
>
> *Christian Pena*
> Network Engineer Supervisor
> *EarthLink Business*
>
> *E: *christian.pena at corp.earthlink.com
> *O:* <786-363-0460>786-363-0460 | *F:* <786-363-0206>786-363-0206
> *STS Telecom is now EarthLink Business*
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110315/500e9b4a/attachment.htm>


More information about the rt-users mailing list