Forums

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

How do I set a custom field with the current date/time in a post function?

Leon Zetekoff December 14, 2017

I'm trying to create bulletins in our wiki and have the creation date along with the updated date appear in a heading (I'm going to make a template). The bulletin name will include the date stamp.

How can I accomplish this?

Thanks leon

2 answers

0 votes
Leon Zetekoff December 20, 2017

how can i manipulate the variable(s) from BuilderInfo so I can add a fixed number (like 90 days) to that variable and then display it?

0 votes
Alexey Matveev
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.
December 14, 2017
import com.atlassian.jira.component.ComponentAccessor
import java.sql.Date
import java.sql.Timestamp
import java.util.Calendar
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue


def csDateTime = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Date Time Picker")


Calendar currenttime = Calendar.getInstance();
Timestamp csNewDateValue = new Timestamp((currenttime.getTime()).getTime());
csDateTime.updateValue(null, issue, new ModifiedValue("", (Object) csNewDateValue), new DefaultIssueChangeHolder())
Leon Zetekoff December 15, 2017

GM ok this is my first attempt at these things. Here's what I want to do I want to display the created date one place, then the last updated date in a different place.

I'm assuming this is a user macro? Newbie here so please accept my apologies in advance.

thanks leon

Leon Zetekoff December 15, 2017

I found a preexisting macro called Builder Info that does what I need.

What I would like to do next is take the creator date and add three months to it and then display that as a review date.

 

thanks leon

Leon Zetekoff December 15, 2017

i found one other item. this is being crafted into a "template" so the created date is the date the template was created not when it was copied/saved as a new item. Anyway we can get around this?

thanks so much leon

Leon Zetekoff December 15, 2017

ok i just tested and if I make a copy of the template and save it off the creator date reflects when it was saved so that is good. so now only need to figure out how to add a certain number days/months to the creator date for the review date

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events