Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can not Copy Due date into Target End Field.

Hi,

 

we have a Due Date Field in our Epics and Stories. People would like to work in the Portfolio and the Roadmaps there are only shown if u select a target start and target end. I created a function in Scriptrunner that copies the Date of the "Due Date" Field into the "Target End" Field. It works but it allways copies the date with -1. SO the Date is never correct. when i enter 30. as Due Date it copies 29. into Target End. Can anybody help me with this?

2 answers

0 votes
Leo Community Leader Sep 23, 2019

hey @SG1337,

can you share your copy field script here to have a look 

BR,

Leo

I used the build in Script in Script Runner "Copie Value of Field so another Field"

@SG1337 

Try something like this:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.issue.index.IssueIndexManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def indexManager = ComponentAccessor.getComponent(IssueIndexManager)
def issueService = ComponentAccessor.issueService

def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey('PT-1858')

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName('yourDateField');
customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), issue.getDueDate()),new DefaultIssueChangeHolder()); // update values

boolean wasIndexing = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
indexManager.reIndex(ComponentAccessor.issueManager.getIssueObject(issue.id));
ImportUtils.setIndexIssues(wasIndexing);

This Script upadates a value and Saves it, it doesnt copy the value from one date field to another tho

yes, updates the value of a date field with the previous value of another date field, isn't that copying a value?

Yes there is a "YourDateFild" where i can enter the source field, where can i enter the target field?

ModifiedValue(issue.getCustomFieldValue(customField), issue.getDueDate())

target field: issue.getCustomFieldValue(customField)

source field: issue.getDueDate()  

I allready found a solution but thx for your answer

So, what was the solution? Would be nice to actually hear

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you