Script Runner -- how do I pull Created Date information from an issue?

Hi,

This is silly, but I am stumped. I am trying to get the created date for an issue. I have a custom Date Picker Field, that needs to be populated by a date that is derived from the Created date plus x number of days based on some logic.

However -- when I try to get the created date, I get an error that I am trying to cast a boolean (see below screenshot).

I am running Jira 5.2.6, and Script Runner 2.1.11

When I look at 5.2.6 API for com.atlassian.jira.issue.IssueImpl, it seems like I should be able to call created -- or getCreated -- and that 'isCreated' is the boolean?

Any tips much appreciated!

1 answer

1 accepted

This widget could not be displayed.
Henning Tietgens Community Champion Jan 14, 2014

You provided your answer :-) Try issue.getCreated(). Sometimes it's not clear for Groovy which method to call...

Ha! You're right. I could have sworn I tried that as well. Maybe I had some weird caching goin on. Anyway, this works:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue

myissue = "TESTPMGMT-17"
IssueManager issueManager = ComponentManager.getInstance().getIssueManager()

Issue issue = issueManager.getIssueObject("$myissue")

Date Created = issue.getCreated()

I will mark your answer as correct. Thanks for the help!

yep, ".created" will call isCreated() in preference to getCreated(). IIRC this is the only place where I've had this problem.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

226 views 3 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you