Forums

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

How to edit date field in post function?

pmlogic2
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!
August 6, 2020

Hi Folks,

I try to Edit the date field (post-function).I can't edit the date field of the current issue. Subsequently, instead of PMLOG-29, you need to use the key of the current issue.

This is my code

 

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.CustomFieldManager

import com.atlassian.jira.issue.MutableIssue

import java.sql.Timestamp

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def dateCf = customFieldManager.getCustomFieldObject("customfield_11706")

def issue2 = ComponentAccessor.getIssueManager().getIssueByCurrentKey("PMLOG-29")

def updated = issue2.getUpdated()

issue2.setCustomFieldValue(dateCf, new Timestamp((new Date() + 2).time))

 

Any suggestions how to solve the problem? Thanks in advance.

Vladimir

1 answer

0 votes
Andrew Morin
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.
August 6, 2020

Suggest an answer

Log in or Sign up to answer