[rt-users] Update DueDate on CF modification

Kenneth Crocker kenn.crocker at gmail.com
Sat Feb 16 14:30:59 EST 2013


Alex,

You need your condition to be user-defined,  something like this:

# Scrip name:  WorkFlow on Next Action

# Condition: User Defined

# Action:      User Defined

# Template:  Global template: Blank

# Stage:        TransactionBatch

#----------------------------------------------------------------------------

# Custom condition:

#----------------------------------------------------------------------------

# Set up initial values



my $trans = $self->TransactionObj;

my $ticket = $self->TicketObj;



# check for CF "Next Action" is 'Post Construction', get out if not



return ($trans->Type eq "CustomField" &&

            $trans->Field eq "50" &&

            $trans->NewValue eq "Post Construction");



return 0;


This allows you to check a specific CF for a specific value.


Kenn

On Fri, Feb 15, 2013 at 4:24 AM, Alex Young <AlexYoung at housingpartners.co.uk
> wrote:

> Hi. I'm using RT 4.0.5. I am trying to update the DueDate field with the
> contents of a custom field with the datetime content. IT works fine on
> creation of the ticket if I set the condition to "On Transaction" or "On
> Create" but it doesn't update the DueDate field if the CF is modified
> later. Any ideas how I can update DueDate when the CF is modified?
>
> My scrip is:
> Condition: On Transaction
> Action: User defined
> Template: Global template: Blank
> Stage: TransactionCreate (Also tried TransactionBatch)
> Custom Condition:
> return 1;
> Custom action prep code:
> return 1;
> Custom action cleanup code:
> ## Turns into yyyy-mm-dd format for date conversion by RT::Date
> my $trans = $self->TransactionObj;
> my $ticket = $self->TicketObj;
> my $cf_date = $ticket->FirstCustomFieldValue('Deployment DateTime');
>
> my $duedate = RT::Date->new($RT::SystemUser);
> $duedate->Set(Format=>'unknown', Value=>$cf_date);
>
> $ticket->SetDue($duedate->ISO);
>
> Thanks.
>
>
> --
> RT training in Amsterdam, March 20-21:
> http://bestpractical.com/services/training.html
>
> Help improve RT by taking our user survey:
> https://www.surveymonkey.com/s/N23JW9T
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130216/ee4e2dcc/attachment.htm>


More information about the rt-users mailing list