Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using a Create/Clone Post-function with JMWE to set a Date Field based on Frequency Field

Dillon
Contributor
June 21, 2021

Hi Atlassian Community;

I am using a Create / Clone Issue(s) Post-function through JMWE and am trying to set up a recurring type workflow with an Audit style issue process.

To simplify it, I have the following setup.

Custom Field A: Issue Frequency

  • Drop-Down field with 3 values
    • Weekly
    • Bi-Weekly
    • Monthly

Custom Field B: Due Date

  • Date Field

On the very first initial issue creation, the creator specifies the Due Date and the Frequency.

As the issue moves through the workflow, on the In-Progress --> Done Transition, the  Create/Clone post-function kicks in and creates a new issue with select fields that copy over.

For the date, I want the 'Due Date' to change from the initial due date to be either

  • + 7 for Weekly
  • + 14 for Biweekly
  • + 31 for Monthly

Based on the Issue Frequency selected.

Is there a way to do this on the Set Field value to Groovy Expression within the Set Fields of New Issue in the Post-Function.

Thank you in advance.

Dillon

1 answer

1 accepted

1 vote
Answer accepted
Suprija Sirikonda _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 12, 2021

Hi @Dillon ,

In the "Create / Clone issue(s) (JMWE app)" post-function, select the "Due Date" field under "Set fields of new issue" and add the below "Groovy Expression"

if(!!issue.get("duedate")) {
switch(issue.get("customfield_10300")) {
case "Weekly": return (issue.get("duedate") + 7)
case "Bi-Weekly": return (issue.get("duedate") + 14)
case "Monthly": return (issue.get("duedate") + 31)
}
}

Replace 10300 with the id of the 'Frequency' field.

JMWE config.png

We have opened a support ticket in the Innovalog support portal to better track your request. However, we couldn't add you as a reporter.  Please sign up using this link and share the user name/id. We'll then add you as the reporter and confirm. 

Regards,

Suprija

Suresh July 25, 2024

@Suprija Sirikonda _Appfire_ 

In the same Create / Clone Issue(s) Post Function by JMWE

, I am creating 2 Tasks with 2 different summaries and custom field populated with 2 different corresponding drop-down values

if summary = "Summary1" then its corresponding studio custom-field ID 20001 value is value1

and if summary = "Summary2" then its corresponding custom-field ID 20001 value is value2

On the studio field, we are setting field value to a groovy expression as below

if(issue.get("summary")) {
switch(issue.get("customfield_20001")) {
case "Summary1": return (issue.get("value1"))
case "Summary2": return (issue.get("value2"))
}
}

 Result value is null.

Suggest an answer

Log in or Sign up to answer