Does someone know how to nudge workflow with the Scheduled Script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 01:06 AM - edited 07-18-2024 01:07 AM
Hey guyz,
I have a Nudge button on the RITM which works if the Workflow stucks, but I also would like to have a Scheduled Job Script that does for me.
At the moment it looks like this, but it doesnt work:
If I execute it on Background Script the System give me this message:
Someone know how to access the "SNC.WorkflowScriptAPI()"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 01:48 AM
There have been threads like this in the past.
What is SNC.WorkflowScriptAPI() & Where Can I find it?
We recommend you find an alternative solution or contact our support team.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 01:51 AM
Hi @IgorMK
The error "SNC is not defined" means `SNC.WorkflowScriptAPI()` isn't available in your scheduled job context. Try these solutions:
1. Use GlideRecord: Instead of `SNC.WorkflowScriptAPI()`, use a GlideRecord script to query and nudge stuck workflows directly:
var gr = new GlideRecord('wf_context');
gr.addQuery('state', 'stuck'); // Modify query as needed
gr.query();
while (gr.next()) {
new Workflow().restartWorkflow(gr);
}
2. Script Include: Create a Script Include for the nudge logic and call it in both your UI action and scheduled job.
……………………………………………………………………………………………………
Please Mark it helpful 👍and Accept Solution✔️!! If this helps you to understand.