Need to create an SLA Repair Flow Action

Chaz Gordon1
Tera Contributor

I need to create a Flow action that triggers the SLA Repair on a task_sla record passed to it via the Inputs.

We are in the process of moving everything that can be moved to Flow from Workflows and Scripting. Our main issue is that while a lot of work has been done to fix problems with SLAs duplicating and not closing the duplicate, we still have a few a day, which are currently being manually repaired roughly daily. Our rogue SLAs are very easy to spot, they are in an in progress state, while the attached task is in a closed state.

I know many will post to chase down the issue causing the duplication, but this has already been done and resolved as best as possible. We operate an external platform that raises thousands of external requests to other platforms via API every day, and for each of these requests, there is a matching API PUT to ServiceNow. The issue is that these requests are created in ServiceNow at the same time that our platform triggers the call to a.n.other platform, then a follow up API call to resolve the ticket is sent once the 3rd party platform acknowledges completion of the request via API response. As many of these external platforms are really quick to complete the requests, we often see a resolve within 15 seconds of the open.

Originally, SLAs were applied in real time as the tickets were opened and closed, this resulted in almost 100% duplication of SLA records. (Thousands a day) in order to resolve this, I set the SLA business rule to background, and this cut the duplication to around 10 a day, so switching back to real time is not an option. It is clear that at times of high demand, the SLA application has not completed by the time the resolve call comes in, and a second background process to apply the SLA is triggered (Albeit to complete(Pause) it). Reconfiguring SLA definitions to Pause on Resolve and complete on Close has also significantly improved the situation, but we are still left with around 1% duplication that would be nice to clear up with an automated process.

Any help would be appreciated. I know this will end up with javascript in the Action, but it would be helpful if that were just a line or two. Our RepairSLA script include is as OOB, but I just can't seem to get it to run from a Flow action.

1 REPLY 1

Chaz Gordon1
Tera Contributor

OK, I worked it out, I'd been chasing my tail over an underscore where it didn't belong!!

 

This is my working Action - So simple in the end:

(function execute(inputs, outputs) {

var SlaID = inputs.sla_id;
var slaRepair = new SLARepair();
slaRepair.repairBySysId(SlaID, "task_sla");

})(inputs, outputs);