Our new Appfire Documentation Space is now live!

Take a look here! If you have any questions please email support@appfire.com

Use cases for post-functions

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.