[rt-users] Problem with making a custom scrip

Bart bart at pleh.info
Tue Jul 26 09:38:29 EDT 2011


Hi Kevin,

Thanks for your reply, that turned out to be toe golden tip :D

I was getting those messages in the Web UI and after changing the type to
transaction batch it worked :D

So to summarize, here's the end result that worked perfectly for me:

   - Condition: On Transaction
   - Action: User Defined
   - Template: Global Template: Transaction
   - Stage: TransactionBatch
   - Custom condition: (empty)
   - Custom action preparation code: return 1;
   - Custom action cleanup code:

my $my_type = $self->TicketObj->FirstCustomFieldValue('Type');
> if ($my_type =~ /^I/) { $self->TicketObj->AddCustomFieldValue(Field =>
> 'SLA', Value => 'Urgent'); }
> if ($my_type =~ /^C/) { $self->TicketObj->AddCustomFieldValue(Field =>
> 'SLA', Value => 'Normaal'); }
> if ($my_type =~ /^P/) { $self->TicketObj->AddCustomFieldValue(Field =>
> 'SLA', Value => 'Laag'); }


All I have to do now is expand the scrip to also check another field, but
that shouldn't be a problem now that this is working :D

Thanks for the help.


Best regards,

Bart



2011/7/26 Kevin Falcone <falcone at bestpractical.com>

> On Tue, Jul 26, 2011 at 02:40:21PM +0200, Bart wrote:
> >    The first problem I have is that the SLA is already set to the value
> "Normal", I see the scrip
> >    running but it keeps saying "Set SLA Low to Normal" or similar for
> Urgent (normal is ignored).
> >    So I get a feeling it does something, but it doesn't actually change
> the content of the SLA
> >    field.
> >    Maybe it's the type of CF that the SLA field is, it's a dropbox with
> the three options Urgent,
> >    Normal and Low. But I thought it shouldn't matter?!
> >    The second problem is that if the SLA field is set to (no value) then
> the scrip gives the
> >    error "Low is no longer a value for custom field SLA", which could be
> the same issue as the
> >    first? Not able to fill the actual field?
> >    Any thoughts on this? (the above code is a little different but I get
> the same results as the
> >    first code)
>
> Where do you see these messages, in the webui?  Are you doing this on
> create or from the Basics page and setting the SLA to normal or unset
> there?
>
> You may need to switch your scrip type to transactionbatch to it runs
> after the web updates finish.
>
> -kevin
>
>
> --------
> 2011 Training: http://bestpractical.com/services/training.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110726/57ddcb82/attachment.htm>


More information about the rt-users mailing list