On this page

Use case

In this use case, several sub-task will be created depending on the frequency of time chosen. A different sub-task will be created for every monthly, quarterly, half-yearly or yearly recurring deadline of a whole year. For example, 12 tickets will be created if the task has 12 recurring deadlines, one for every month of the year, and only 2 if the task has 2 internal deadlines, one for every six months, from the current date.

Prerequisites

Set up custom fields

Create two custom fields to define the frequency and a base date.

Custom fields

Create a Date Picker field and name it Deadline.

Create a Single Select field and name it Frequency.

Add the following options to the field:

  • Monthly
  • Quarterly
  • Half-yearly
  • Yearly


Configuration

Add a Create issue post function to the workflow transition of your choice.

Issues to be created

Mode

Choose Multiple issues.

Expression

Write an expression using this format with parsing mode in Number.

getMatchingValue(%{issue.cfFrequency}, ["Monthly", "Quarterly", "Half-yearly", "Yearly"], [12, 4, 2, 1])

Issue type

Choose Sub-task

Parent issue

Choose Current issue

Summary

"Sub-task with deadline on " + dateToString(addMonths({system.currentDateTime}, (^) * getMatchingValue(%{issue.cfFrequency}, ["Monthly", "Quarterly", "Half-yearly", "Yearly"], [1, 3, 6, 12]), LOCAL), LOCAL, SERVER_LANG)

Deadline

Set the field Deadline

addMonths({system.currentDateTime}, (^) * getMatchingValue(%{issue.cfFrequency}, ["Monthly", "Quarterly", "Half-yearly", "Yearly"], [1, 3, 6, 12]), LOCAL)

Conditional execution

Add a conditional execution to avoid executing the rule with the sub-tasks if they share the workflow with the parent task.

%{issue.issueType} = "Task"



If you still have questions, feel free to refer to our support team.