I have a business rule that needs to run before an incident update. The problem is that this script needs to fire off a function from "Script Includes" that is slow. I want this call to be asynchronous so that the form can load.
Is there any way to do this?
I'm assuming you already know about async business rules, and that those don't work for you because you need to also do something synchronously.
You can use GlideRunScriptJob
from script to execute a script on a background thread. If you already have a script, you just pass it as a string to the scheduleScript
method on GlideRunScriptJob like so:
var job = new GlideRunScriptJob();
job.scheduleScript("new CustomScriptInclude().foo()");