Hi Kevin,<div><br></div><div>Thanks for your reply, that turned out to be toe golden tip :D</div><div><br></div><div>I was getting those messages in the Web UI and after changing the type to transaction batch it worked :D<div>
<br></div><div>So to summarize, here's the end result that worked perfectly for me:</div><div><ul><li>Condition: On Transaction</li><li>Action: User Defined</li><li>Template: Global Template: Transaction</li><li>Stage: TransactionBatch</li>
<li>Custom condition: (empty)</li><li>Custom action preparation code: return 1;</li><li>Custom action cleanup code:</li></ul><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
my $my_type = $self->TicketObj->FirstCustomFieldValue('Type');<br>if ($my_type =~ /^I/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Urgent'); }<br>if ($my_type =~ /^C/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Normaal'); }<br>
if ($my_type =~ /^P/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Laag'); }</blockquote><div><br></div><div>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</div>
<div><br></div><div>Thanks for the help.</div><div> </div></div></div><div><br clear="all">Best regards,<br><br>Bart<br><br>
<br><br><div class="gmail_quote">2011/7/26 Kevin Falcone <span dir="ltr"><<a href="mailto:falcone@bestpractical.com">falcone@bestpractical.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Jul 26, 2011 at 02:40:21PM +0200, Bart wrote:<br>
> The first problem I have is that the SLA is already set to the value "Normal", I see the scrip<br>
> running but it keeps saying "Set SLA Low to Normal" or similar for Urgent (normal is ignored).<br>
> So I get a feeling it does something, but it doesn't actually change the content of the SLA<br>
> field.<br>
> Maybe it's the type of CF that the SLA field is, it's a dropbox with the three options Urgent,<br>
> Normal and Low. But I thought it shouldn't matter?!<br>
> The second problem is that if the SLA field is set to (no value) then the scrip gives the<br>
> error "Low is no longer a value for custom field SLA", which could be the same issue as the<br>
> first? Not able to fill the actual field?<br>
> Any thoughts on this? (the above code is a little different but I get the same results as the<br>
> first code)<br>
<br>
</div>Where do you see these messages, in the webui? Are you doing this on<br>
create or from the Basics page and setting the SLA to normal or unset<br>
there?<br>
<br>
You may need to switch your scrip type to transactionbatch to it runs<br>
after the web updates finish.<br>
<font color="#888888"><br>
-kevin<br>
</font><br><br>
--------<br>
2011 Training: <a href="http://bestpractical.com/services/training.html" target="_blank">http://bestpractical.com/services/training.html</a><br></blockquote></div><br></div></div>