start a workflow from script action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 05:27 AM - edited 02-29-2024 05:55 AM
Hello,
I have a script action which starts a workflow. The script action gets triggered by a business rule. The problem is when the script action starts the workflow the inputs are empty in the workflow. Even though i am passing the inputs. It works in script backgrounds. Anything i am missing here ?
below is the script action code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 05:50 AM
Based on the script you provided, here are some potential issues and solutions:
- The workflow inputs are not being passed correctly. Ensure that the inputs are being passed as an object with the correct properties.
- The workflow is not in a 'finished' state. The script checks if the workflow is in a 'finished' state before restarting it. If the workflow is not in a 'finished' state, it will not be restarted.
- The workflow context ID or inputs are not provided. The script checks if the workflow context ID and inputs are provided. If they are not, the script will not execute.
- The workflow record cannot be retrieved. The script attempts to retrieve the workflow record using the workflow context ID. If the record cannot be retrieved, the script will not execute.
Here are the steps to troubleshoot:
1. Check the inputs being passed to the script action. They should be an object with the correct properties.
2. Check the state of the workflow. It should be in a 'finished' state for the script to restart it.
3. Ensure that the workflow context ID and inputs are being provided to the script action.
4. Check if the workflow record can be retrieved using the workflow context ID.
5. If the workflow is not in a 'finished' state, you may need to manually set it to 'finished' before running the script.
6. If the workflow record cannot be retrieved, check the workflow context ID and ensure it is correct.
7. If the inputs are not being passed correctly, you may need to adjust the script to correctly handle the inputs.
8. If all else fails, you may need to debug the script to identify the issue. Use the gs.log() function to log variables and check their values at runtime.
nowKB.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 05:52 AM - edited 02-29-2024 05:58 AM
The script is starting the workflow. In the workflow its inputs are empty even though i am passing the correct inputs in script action. I want to understand why the inputs are empty.
when i run the script from script backgrounds, it starts the workflow correctly.