Advanced Routing Configuration
Estimated reading: 1 minute
You can also define routing rules by scripting.
Let’s say you want to write the previous routing rule using scripting.
To do this, we go to the menu: System -> Service Design -> Routing.
Here we will have to click on the “New Rule” button.
Now the following screen will open:
We enter as a name “Assign To Admin Every Incident”.
In the “Input (Script)” field, we enter the following code:
//if the current operation is an incident, return true else return false
if($model->getData('type_id')==1){
return true;
}
else{
return false;
}
In the field “New Values (Script)” we enter the following code:
//setting the Assigned username to admin, admin is the username of "System Admin"
$model->setData('assigned_username','admin');
//Returnning the model
return $model;
At this point, we click the “Save” button.
As a last operation on the main screen of the routing rules, we click on the “Disabled” inscription corresponding to the rule we want to enable.