I know I could just store the script in a file from within the "Script Editor" section of ScriptRunner, and then just use that for a Post-Function and a Scheduled Job, but I was wondering if there is a way to execute a scheduled job once from inside a Post-Function (so via Workflow Button) directly, as if you would press the "Run now" button on the jobs page manually.
Basically in pseudo code:
import com.onresolve.scriptrunner.scheduledJobManager
import com.onresolve.scriptrunner.scheduledJob
ScheduledJobManager scheduledJobManager = ComponentAccessor.getScheduledJobManager()
ScheduledJob scheduledJob1 = scheduledJobManager.getJob("JobThatDoesSomething")
scheduledJob1.run()
Thanks for your reply.
I know how to write post-functions, and I read the documentation.
What I'm looking for is a way to import a custom Scheduled Job (that I created and runs every day) into a custom Post-Function script, and execute it from there (as if I pressed "Run now" on the Scheduled Job's page).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Welcome!
Copy the script to the post function, modify as needed, and be done with it. I know this isn't the answer you want, but you're asking to do something that "isn't easily possible." It is possible through the Java API, like every function in the app, but you should asses how much effort you are willing to put in and the value of the output. Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see what you mean. I was hoping there to be a brief code snippet to do that, but I guess I can work with Script Runner's Script Editor too, and just have the code in a file as one central place, and then use that file as the job and the post-function.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.