I’m currently working on making a scrip for RT4 which should eventually
allow us to do the following:
- User fills in the CF ticket type: Incident, Problem or Change.
- User fills in the CF priority: 1, 2, 3 or 4. (in this setup we chose to
make this a CF so that we can restrict the values entered)
- Based on the combination of those CF’s the SLA field is automatically
filled with the appropriate SLA for that combo.
- The SLA CF has these fixed values: Urgent, Normal, Low.
- It’s the SLA field that you get from the plugin.
I found this scrip on the wiki which almost does what I want:
As a result I’m now looking at making a simple statement which sets the SLA
based on te ticket type alone (for now).
When that part is working I would expect that expanding the scrip to also
incorporate the priority wouldn’t be too difficult.
This is what I’ve come up with so far:
- Condition: On status change
- Action: User defined
- Template: Global Template: Transaction
- Stage: TransactionCreate
Custom action preparation code: return 1;
Custom action cleanup code:
my $my_type = $self->TicketObj->CustomFieldValues(‘Type’);
my $my_sla = ‘Urgent’ if ($my_type =~ /^I/);
my $my_sla = ‘Normal’ if ($my_type =~ /^C/);
my $my_sla = ‘Low’ if ($my_type =~ /^P/);
$self->TicketObj->AddCustomFieldValue( Field => ‘SLA’, Value => $my_sla );
At this point I’m kinda stuck, no matter how I fill in this part it always
sets the SLA field to Normal regardless of the content in the CF type.
Can someone point me in the right direction for this? I’d love to get this