A post function doesn't seem to run
How to find out whether a Script Master post function ran, and why it didn't do what you expected.
Symptomβ
After a transition, the change your post function should make, such as a comment or a field value, isn't there. The work item shows no error.
Find the causeβ
- Open the workflow and edit the post function on that transition.
- Look at Recent runs under the editor, and select the latest run to see its console output and error.
- If there's no run at the time of the transition, check the runs around it first. Successful runs are recorded at most once every 5 minutes per post function, so a missing success doesn't prove the post function didn't run. See What is kept. If it still looks like it didn't run, go to The post function isn't on that transition.
- If the run failed, go to The script failed.
- If the run succeeded, go to The script ran but changed nothing.
Recent runs needs a Jira admin. Space admins of team-managed spaces can't open it. To see the error, test the script on the work item in the editor's test panel.
The post function isn't on that transitionβ
Cause: The post function is on another transition or another workflow, or the workflow with it isn't the one the space uses.
Solution: Check the workflow on the Workflows tab in Script Master, which lists each workflow's scripted rules. See The Workflows tab.
The script failedβ
Cause: The script threw an error or couldn't reach the Companion App. The transition still happened: post functions run after the move.
Solution: Read the error in the run. If it says Local script execution is not supported., see Server-side modules show "Action Required". Otherwise fix the script and test it. See Workflow post functions.
The script ran but changed nothingβ
Cause: A request to Jira can fail without the script failing: requestJira returns the error response instead of throwing, so the run still counts as a success.
Solution: Log the response status and body of each request with console.log, run the transition again, and read the output in Recent runs.
Relatedβ
- Workflow post functions: how post functions run.
- Run history: which runs are kept.