Dear everyone,
I have to make a script that writes a calculated value into a new custom field.
Where the problem starts... there are around 30.000 tickets in more than 20 different projects, and updated date must have to stay untouched, cause it's necessary in following previous jobs.
I've tried to fill my custom field and restore the old date value at the same script:
mutIssue.setCustomFieldValue(customfield,value);
mutIssue.setUpdated(existingDate);
im.updateIssue(user, mutIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
and just restore date from change history,
...but it seems like "Updated" field can't be set back to a given timestamp.
Any idea how can I do it?
Hi @Kiss Zoltán
I know, there is a way how to not to touch history items, so maybe "updated" date won't be touched too.
Could you try to update the issue this way?
issue.setCustomFieldValue(customField, valueToSave)
Map<String, ModifiedValue> modifiedFields = issue.getModifiedFields()
FieldLayoutItem fieldLayoutItem =ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem(customField)
DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder()
final ModifiedValue modifiedValue = (ModifiedValue) modifiedFields.get(customField.getId())
customField.updateValue(fieldLayoutItem, issue, modifiedValue, issueChangeHolder)
If you won't be able to resolve imports, feel free to get back to me and I will try to prepare nicer script... I just have to leave the office, so I tried to provide FAST help :)
Have a nice weekend
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.