Use Cases for Post-Functions (Legacy)

Use Cases for Post-Functions (Legacy)

Note: the Use Cases detailed on this page are still mostly valid! However, they are in the process of being updated, both in format and in specific post-function configurations that have been changed in recent JMWE updates.

This section has use cases that help you in understanding the usage of post functions. A few post-functions of JMWE have been deprecated and will no longer be enhanced. However, they still continue to work and you can configure and use the post-functions. But it is recommended to use their replacements instead.

On this Page

Assign to role member

A workflow post-function that assigns the target issue to a member of a selected project role. 

Sample use cases:

 On the creation of a Bug assign it to a user only if he is a Product Owner

  • Create a Product Owner project role, with the product owner as the only member.

  • Add the Assign to role member post-function to the Create transition of the Bug workflow.

  • Select Product Owner as the project role.

  • Select the Conditional execution check box Run this post-function only if a condition is verified.

  • Input the following code template in Condition.

    {{ issue.fields.issuetype.name == "Bug" }}

 Assign an issue to a member of the QA team when the issue is transitioned to Ready for testing status

  • Create a QA project role, with the testers as its members.

  • Add the Assign to role member post-function to the transition that leads to Ready for testing.

  • Select QA as the project role to look for.


 Assign an issue to a member of the Support - UTC project role only when the reporter time zone is UTC.

  • Add the Assign to role member post-function to the Create transition of the issue workflow.

  • Select Support-UTC as the project role.

  • Select the Conditional execution check box Run this post-function only if a condition is verified.

  • Input the following code in Condition.

    {{ issue.fields.reporter | userProperty("TimeZone") == "UTC" }}

On approving a Story assign the subtasks of the Story to a member of the Developer project role

  • Add the Assign to role member post-function to the Approve transition of the issue workflow.

  • Select the “Target Issue(s)” as “Sub-tasks of the current issue”

  • Select Developers as the project role.

Assign to last role member

A workflow post-function that assigns the target issue to the last assignee who belongs to the selected project role.

Sample use cases: 

 When a tester reopens an issue assign the issue to a Developer who last worked on it.

  • Create a Developer project role, with the developers as its members.

  • Add the Assign to last role member post-function to the Reopen transition.

  • Select Developer as the project role to look for.

 After testers have validated an issue, it should be assigned to the last product owner who worked on it for the functional validation. The product owner might either have been explicitly assigned to the issue before, to write the functional specification or have written the specification while creating the issue.

  • Create a Product Owner project role, with the product owners as its members.

  • Add the Assign to last role member post-function to the Validate transition of the User Story workflow.

  • Select Product Owner as the project role to look for.

  • Select Include Reporter option in case a product owner created the issue but was never assigned to it afterward

Assign the Story to the tester who last worked on the Story when all the bugs blocking the Story are fixed

  • Add the Assign to last role member post-function to the Done transition of the Bug workflow

  • Select “Target issue(s)” as “Issues linked to the current issue through the following link type”

  • Select “blocks”

  • Select Testersas the project role to look for.

  • Select the “Conditional execution” option

  • Input the following script:

    {% set linkedIssues = targetIssue | linkedIssues("blocks",["status"]) | filter(["key",issue.key],true) %} {{linkedIssues | filter(["fields.status.name","Done"],true) | length == 0 }}

Build-your-own (scripted) Post-function

A post-function that allows you to run an arbitrary Nunjucks template (script). This can be used to create your own post-functions.

Add a worklog entry to the issue. You can do this using the callJira custom Nunjucks filter.

  1. Add the “Build-your-own (scripted)” post-function to the transition

  2. Input the following Nunjucks template

    {{ "/rest/api/2/issue/:issue/worklog" | callJira(verb=("post"), params={"issue":issue.key}, body={ "timeSpent": "1w" } ) | dump(2) }}

     

  3. Save the post-function and publish the workflow

Clear fields

A workflow post-function that clears the value(s) of the selected field(s) of the target issue.

 Clear the Fix Version/s field on the reopening of a ticket.

  • Add the Clear field value post-function to the Reopen transition of the workflow.

  • Select the field Fix Version/s to from Field.

Clear a set of fields on all the linked issues of the current issue when an Abort is triggered on the current issue

  • Add the Clear field value post-function to the Abort transition of the workflow.

  • Select the “Target Issue(s)” as “Issues linked to the current issue through any link type”

  • Select all the fields to be emptied from Field

Clear fields of linked issues - Deprecated - Use Clear Fields instead

A workflow post-function that clears the value of the selected field(s) of the issues linked to the current issue through a specific link type.

 Clear a set of fields on all the linked issues of the current issue when an Abort is triggered on the current issue

  • Add the Clear field value of linked issues post-function to the Abort transition of the workflow.

  • Select all the fields to be emptied from Field

Comment issue(s)

A workflow post-function that creates a comment on the target issue(s). The text of the comment to be created can be any simple text or a text with Nunjucks annotations.

Sample use cases:

 A customer using Jira Service Desk should be notified via comment when someone has started working on their support request.

  • Add the Comment issue(s) post-function to the Start Progress transition of the issue's workflow.

  • Write the following content in the Comment section.

    {{issue.fields.assignee.name}} has started working on your support request. We will get back to you within 24 hours.

 On resolving or closing the issue, comment the issue with a summary of the worklog.

  • Add the Comment issue(s) post-function to the Resolve transition of the issue's workflow.

  • Write the following content in the Comment section.

    {% set worklogs = issue.fields.worklog.worklogs %} {% set count = 1%} {% for worklog in worklogs %} Worklog {{count}}: Started : {{ worklog.started }} Time Spent : {{ worklog.timeSpent }} Work Description : {{ worklog.comment }} {% set count = count + 1 %} {% else %} No work logged for this issue {% endfor %}

An issue is blocking another and you want to ensure the Assignee of the blocked issue is notified when the impediment has been resolved.

  • Add the Comment issue(s) post-function to the transition that resolves the current issue.

  • Select the “Target issue(s)” as “Issues linked to the current issue through the following link type:”

  • Select the issue link type blocks under “Issue Link”

  • Write the following content in the Comment section.

    The impediment {{targetIssue.key}} - "{{targetIssue.fields.summary}}" has been resolved.

 Add a comment on all the sub-tasks when the parent is canceled

  • Add the Comment issue(s) post-function to all the transitions of the internal issue workflow.

  • Select the “Target issue(s)” as “Sub-tasks of the current issue”

  • Write the following content in the Comment section.

    {{ issue.fields.comment.comments | last | field("body") }}

 On the Approval of an issue, copy the comment added if any to its sub-tasks.

  • Add the Comment issue(s) post-function to all the transitions of the internal issue workflow.

  • Select the “Target issue(s)” as “Sub-tasks of the current issue”

  • Write the following content in the Comment section.

    {% if issue.fields.comment.comments and now | date("clone") - issue.fields.comment.comments | last | field("created") | date("clone") < 6000 %} {{ issue.fields.comment.comments | last | field("body") }} {% endif %}

 Add a comment on the Epic when its user story is resolved.

  • Add the Comment issue(s) post-function to the Resolved transition of the Story workflow.

  • Select the “Target issue(s)” as “Epic of the current issue”

  • Write the following content in the Comment section.

    The user story {{issue.key}} - "{{issue.fields.summary}}" has been resolved.

 The Service Desk Agent responsible for a support request should be notified when the linked Bug is resolved.

  • Add the Comment issue(s) post-function to the Resolved transition of the Bug workflow.

  • Select the “Target issue(s)” as “Issues linked to the current issue through the following link type:”

  • Select the issue link type blocks under “Issue Link”

  • Write the following content in the Comment section.

    {{issue.key}} has been resolved. You should get back to the customer.
  • Check the Restrict to internal (Jira Service Desk only) option to make sure the customer doesn't see the comment.

Comment linked issues - Deprecated - Use Comment issue(s) instead

A workflow post-function that creates a comment on all issues linked to the current issue through a selected link type. The text of the comment to be created can be any simple text or a text with Nunjucks annotations.

Sample use cases:

 An issue is blocking another and you want to ensure the Assignee of the blocked issue is notified when the impediment has been resolved.

  • Add the Comment linked issues post-function to the transition that resolves the current issue.

  • Choose the issue link type blocks

  • Write the following content in the Comment section.

    The impediment {{issue.key}} - "{{issue.fields.summary}}" has been resolved.

 Add a comment on all the sub-tasks when the parent is canceled

  • Add the Comment linked issues post-function to all the transitions of the internal issue workflow.

  • Choose the issue link type is Parent of

  • Write the following content in the Comment section.

    {{ issue.fields.comment.comments | last | field("body") }}

 On the Approval of an issue, copy the comment added if any to its sub-tasks.

  • Add the Comment linked issues post-function to all the transitions of the internal issue workflow.

  • Choose the issue link type is Parent of

  • Write the following content in the Comment section.

    {% if issue.fields.comment.comments and now | date("clone") - issue.fields.comment.comments | last | field("created") | date("clone") < 6000 %} {{ issue.fields.comment.comments | last | field("body") }} {% endif %}

 Add a comment on the Epic when its user stories are resolved.

  • Add the Comment linked issues post-function to the Resolved transition of the Story workflow.

  • Choose the issue link type belongs to Epic 

  • Write the following content in the Comment section.

    The user story {{issue.key}} - "{{issue.fields.summary}}" has been resolved.

 The Service Desk Agent responsible for a support request should be notified when the linked Bug is resolved.

  • Add the Comment linked issues post-function to the Resolved transition of the Bug workflow.

  • Choose the issue link type blocks

  • Write the following content in the Comment section.

    {{issue.key}} has been resolved. You should get back to the customer.
  • Check the Restrict to internal (Jira Service Desk only) option to make sure the customer doesn't see the comment.

Copy comments to related issues

A workflow post-function that copies the comment(s) of the current issue to the specified related issues

Sample use cases:

 When a developer transitions an issue to "Customer Feedback" copy the developer's comment on the transition screen to the linked issue.

  • Add the Copy comments to related issues post-function to the transition.

  • Select the “Target issue(s)” as “Issues linked to the current issue through the following link type:”

  • Select the issue link type under “Issue Link”

  • Choose The comment added on the transition screen, if any under Comments to copy

  • Click on Add

 Configure bi-directional sync of comments between the issues linked through the “causes” link type.

  • Create a global transition “Sync Comments”

    • Add the Copy comments to related issues post-function to the transition

    • Select the “Target issue(s)” as “Issues linked to the current issue through the following link type:”

    • Select “causes” under “Issue Link”

    • Choose All comments

    • Add another Copy comments to related issues post-function to the transition

    • Select the “Target issue(s)” as “Issues linked to the current issue through the following link type:”

    • Select “is caused by” under “Issue Link”

    • Choose All comments

    • Add a few seconds delay

  • Click on Add

Now when you trigger the transition on the issue(s), the newly added comments on the issue are added to the linked issue

Create issue

A workflow post-function that creates one or more new issue(s). The specifications of the issue(s) to be created can be customized using the options provided.

Sample use cases:

 Create a documentation ticket only if "Needed" is selected in the "Documentation ticket" checkboxes field

  • Add the Create issue post-function to the transition on whose trigger you want to create a documentation ticket

  • Select Documentation from the Project field.

  • Select Document from the Issue type field.

  • Select caused by in the Link to new issue section.

  • Add an appropriate Summary (such as Release documentation)

  • Select the conditional execution and write the following template

    {{ issue.fields["Documentation ticket"] | find({"value":"Needed"}) != null }}

 On the approval of a Story, create two sub-tasks: one for Development and another for QA.

  • Add the Create issue post-function to the transition Approve of the Story workflow to create a QA ticket.

  • Select Same as current issue from the Project field.

  • Select Subtask from the Issue type field.

  • Select Current issue from the Parent issue field.

  • Add an appropriate Summary (such as Validation)

  • Repeat the above steps for the Development ticket.

 We use Jira Service Desk for support and Jira Software for development. When the support agent's problem analysis identifies a bug, a Bug should be created in the development project.

  • Add the Create issue post-function to the Create transition of the Service desk project workflow.

  • Select the Development project from the Project field.

  • Select Bug from the Issue type field.

  • Set Summary field to {{issue.fields.summary}}

  • Select caused by in the Link to new issue section.

 To onboard a new employee in the HR database, create tasks for the New Employee ticket for Configuring a new computer system, Set up an employee phone and Configure a new employee work space.

  • Add the Create issue post-function to the transition Create of the New Employee ticket workflow.

  • Select Same as current issue from the Project field.

  • Select Sub-task from the Issue type field.

  • Select Current issue from the Parent issue field.

  • Edit the Summary field value to : Configuring a new computer system

  • Repeat the above steps for the remaining tickets.

 An Epic has a Story and the Story has a sub-task. When the sub-task is reopened we want to create a bug in another project linking it to the sub-task. On creation of the Bug, set its Epic link to the Story's Epic link

  • Add the Create issue post-function to the Reopen transition of the sub-task workflow.

  • Select the project from Project

  • Select the Bug in Issue type

  • Select is caused by in Link to new issue

  • Select the Epic Link field in Set fields of new issue.

  • Write the following in the Value section

    {% if issue | linkedIssues("is caused by") %} {{ issue | linkedIssues("is caused by") | first | parentIssue | field("Epic Link") }} {% endif %}

 When a user raises a bug report, post-verification, automatically add it to the backlog in the development project and copy the issue links of the Bug to the newly created issue.

  • Add the Create issue post-function to the transition the Verify of the Bug workflow.

  • Select Development from the Project field.

  • Select Task from the Issue type field.

  • Select duplicates in the Link to new issue section.

  • Add an appropriate Summary (such as Duplicates - {{ issue.key}})

  • Select the field Linked Issues from the Set fields of new issue section.

  • Select Copy value from current issue from the drop-down.

  • Add the post-function.

Copy field value from linked issues

A workflow post-function that sets the value(s) of a selected field to the value(s) from the same/different field of an issue linked to the current issue through a selected link type.

Sample use cases:

 Copy the Fix Version/s field from the Epic to a Story, while creating a Story.

  • Add the Copy field value from linked issues post-function to the Create transition of the Story workflow.

  • Choose the has Epic link type.

  • Select Fix Version/s in Source Field.

  • Select Same as source field in the Destination field.

 Automatically add the Reporter of an Epic to the watchers of its User Stories while creating a Story.

  • Add the Copy field value from linked issues post-function to the Create transition of the Story workflow.

  • Select Reporter in the Field.

  • Select Watchers in the Destination field.

Need support? Create a request with our support team.

Copyright © 2005 - 2026 Appfire | All rights reserved.