Forums

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

behavior: Approval date needs to set current date and users can able to select new date

Omprakash Thamsetty
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.
March 4, 2020

Hi,

 

I am writing behavior for approval date during the approval transition for one of my issue. Look like I can set to default  current date but unable to save the changes that user selected manually/changed the date.  How I can allow users to select date if the approval date is not current date during the approval transition

 

Here is the code that I wrote

import com.atlassian.jira.component.ComponentAccessor
import java.text.SimpleDateFormat
import java.util.Date
import java.util.TimeZone

def appDatefld = getFieldById(getFieldChanged())

//def the "results" field from the view screen (underlying issue)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def appDatefldId = customFieldManager.getCustomFieldObject(appDatefld.getFieldId())

String DATE_FORMAT = "dd/MM/yy"
SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT)
String CurrentDate = new java.sql.Timestamp(new Date().getTime()).format('MM/dd/yyyy')
//Date date = formatter.parse(CurrentDate)

if (!underlyingIssue?.getCustomFieldValue(appDatefldId)) {
appDatefld.setFormValue(CurrentDate)

}

 

Any suggestion?

0 answers

Suggest an answer

Log in or Sign up to answer