Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,409,991
Community Members
 
Community Events
169
Community Groups

Get the assignee date and put it into a script field

Hi,

 

i want to know if we can get the assignee date of a jira issue and put it into a script field or something similar with Date type.

 

Our Business need to know when a jira issue has been assigned to someone while making a jql filter.

 

Many thanks in advance.

 

Best Regards,

Wajih

2 answers

1 accepted

1 vote
Answer accepted
Gikku Rising Star Dec 04, 2019

Hi @wajih zouaoui 

You can create a Date Time picker custom field and put below code to capture the time of assignment into that.

This needs to be added as Script Runner custom listener for the event 'Issue Assigned'

 

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import java.sql.Timestamp
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def issue = event.issue as Issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def datecf1 = customFieldManager.getCustomFieldObject('customfield_xxxxx') //custom field ID

def val = new Timestamp((new Date()).time)

def changeHolder = new DefaultIssueChangeHolder()
datecf1.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(datecf1), val),changeHolder)

Gikku Rising Star Dec 04, 2019

Hi @wajih zouaoui 

You can modify the code if you just want to capture the date only.

HI @Gikku ,

 

many many thanks for your help it works as a charm.

Do you please have a documentation or seomthing that it can help improving our skills in groovy script runner for jira ?

 

Thanks a lot.

 

Regards,

Wajih

Gikku Rising Star Dec 04, 2019

Hi @wajih zouaoui 

I don't have any documentation link available but usually for such requirements I browse through the Script runner examples within Community or Adaptivist documentations and also refer the Jira API documents for the version.

You can also follow the Youtube videos here

Regards
Gikku

Hi @Gikku ,

 

thanks again and i'll follow your advices for sure :) .

 

Best Regards,

Wajih

Like Gikku likes this

Very helpful, thanks very much!

Suggest an answer

Log in or Sign up to answer