For example, consider a use case where you want to clone an issue and its subtasks to another project, then:
Navigate to the Jira Settings → Apps → Shared actions
Click on "Shared actions"
Click on "New shared action"
Add a name "Clone ticket and its subtasks" and an optional description
Click on "Add post-function"
Select the "Create issue" post-function.
Select the destination project in "Project"
Select the "Link to new issue" as "clones"
Configure the fields
Click on Save
Click on "Add post-function"
Select "Create issue" post-function to clone the sub-tasks
Select the destination project in "Project"
Select the "Issue type" as "Subtask"
Under the "Parent issue" input the following template:
Code Block language js {{ context.newIssueKey }}
Select "Multiple issue creation" option and input the following template:
Code Block language js {{ issue | subtasks | length }}
Save the post-function.
Click on "Save"
Go to the workflow editor, pick the transition and add the "Shared action" post-function
Select "Clone ticket and its subtasks"
Click on "Add"
Publish the workflow
Error handling
If one of the post-functions fails with an error, the remaining post-functions in the sequence are run anyway. To stop the execution of subsequent post-functions after an error occurs, select the option “Skip subsequent post-functions if a post-function encounters an error”.
Conditional execution
To execute this post-function based on the result of a Nunjucks template see Conditional execution.