SLA Set Due/Starts in scrip


I would like to change the SLA and/or starts+due dates when a custom field is selected or not.

This scrip solution to change it when the queue changes is also useful:

On changing queue, I’d also like to set it to the default queue SLA days or the due date according to the SLA, if SLA is enabled on the queue.

However, documentation for RT::SLA->GetDefaultServiceLevel and RT::Action::SLA_SetDue are a little sparse, for example how to use it in a Scip action?