Forums

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

Help converting Groovy to Nunjucks

Joao Marcoski
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 18, 2023

We have some workflows from our Jira server using the JMWE app that have some groovy expressions in them written by someone who has since left.

 

After migrating to the cloud we now need to convert these to Nunjucks or Jira expression - would anyone have an idea how this would look in Jira - its a simple number generator

 

//Target End

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.Date;
import java.sql.Timestamp

DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
def dt = LocalDateTime.now().format(formatter)
def date = Date.parse("dd/MM/yyyy", dt)
Timestamp ts = new Timestamp(date.getTime());

 

(unless the field already has a value).

1 answer

1 vote
David Fischer
Community Champion
September 18, 2023

Hi @Joao Marcoski 

I'm having a hard time understanding what this is supposed to do. It looks like the value is a Timestamp representing the current date. Can you share the full configuration of the Server post-function? And also the custom field type of the field the post function is setting?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events