To create a subtask only if one does not already exist for the respective parent issue can be achieved using the app Create On transition. If subtask doesn't already exist for the parent issue, then adding the below post function will create a subtask else it will not generate the subtask at the time of transition of the workflow.
You need to add a Post Function using the app Create on Transition in your respective workflow associated with the parent issue.
Instructions
Steps to create a post-function for this scenario.
- Log into Jira system as a Jira Administrator and click > Issues.
- Under the Workflows section, select the workflow to click on Edit link.
- Now select the transition steps to add the post- function.
4. Click on Add Post Function link and then select Create Sub-task option. After this click on Add button.
5. Now add the below Post Function.
6. Publish the workflow and rerun the scenario.
Add the above Post Function in your Dev/Staging environment first and then implement it in the Production environment.