FormField startDate=getFieldById("customfield_XXXX")
startDateValue1=startDate.getValue()
now if suppose customfield_XXXXX has value 27/Apr/15 10:30 AM.
I am getting startDateValue1 as Mon Apr 27 00:00:00 UTC 2015 which is missing the time part completely.
JIRA Version : 6.1.7
Has anyone noticed this
Thanks in advance
Best Reagrds,
Sumit
I have written a groovy script to do the needful , can close this thread now. Any research will still be an help.
Thanks,
Sumit
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.event.type.EventDispatchOption;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.MutableIssue
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import java.sql.Timestamp
Logger log = Logger.getLogger("Filling EndTime")
log.setLevel(Level.DEBUG)
ComponentAccessor comAcc=new ComponentAccessor()
CustomFieldManager cfm = comAcc.getCustomFieldManager()
CustomField startTime = cfm.getCustomFieldObject('customfield_ABC') // id to be changed
CustomField endTime = cfm.getCustomFieldObject('customfield_BCD') // id to be changed
CustomField duration = cfm.getCustomFieldObject('customfield_CDE') // id to be changed
startTimeValue=issue.getCustomFieldValue(startTime)
endTimeValue=issue.getCustomFieldValue(endTime)
durationValue=issue.getCustomFieldValue(duration)
// log.debug("Updating Time")
// log.debug("startTimeValue ::: ${startTimeValue}")
// log.debug("durationValue ::: ${durationValue}")
// log.debug("endTimeValue ::: ${endTimeValue}")
long value
if (startTimeValue!=null && durationValue!=null){
value=((startTimeValue.getTime()/(1000*60)) + durationValue)*1000*60
newtime =new Timestamp(value)
def changeHolder = new DefaultIssueChangeHolder();
endTime.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(endTime), newtime),changeHolder)
}
return null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am facing the issue. How do i get the date and time from datetime custom field?
I have a field called Release Window as dropdown (Window A, Window B) and another field RFC deployment date / time as Custom Datetime field.
If the user choose any time another than Tuesday 6 PM to Wednesday 5.30 AM, i would like to display a error message immediately. I am using behavior script to achieve this.
The issue is ld_rfcdeploymentdate returning the value only with date and time stamp is showing as 00.00.0
FormField rfcdeploymentdate = getFieldByName ("RFC Deployment Date")
Date ld_rfcdeploymentdate = rfcdeploymentdate.getValue()
Window A | Tuesday 6:00pm - 5:30am |
Window B | Thursday 6:00pm - 5:30am |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, I'm meeting the same issue when trying to set a default date of a date/time custom field value from another one.
Can you help us please?
FormField slaveField1 = getFieldById ("customfield_10406") FormField masterField = getFieldById ("customfield_10404") Date master = (Date) masterField.getValue() slaveField1.setFormValue(master.format("dd/MM/yy HH:mm"));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.