Hi,
I'm looking to copy values between custom fields, mainly at Issue Create but it could be at any workflow transition.
I can see suggestions how to do this using scriptrunner and add-ons.
Is there another way to achieve this without add-ons?
Many thanks
Mark
Hello @mark.barringer
Its easy to do with scriptrunner, you can use Script postfunction or Script LIsteners on Issue Created, Issue Updated event (which means every time issue created or updated, listeners catch that issue and perform coded actions)
Here example code. for listeners or workflow transitions
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customField1 = customFieldManager.getCustomFieldObjectByName("customfield1name")
def customField2 = customFieldManager.getCustomFieldObjectByName("customfield2name")
//for workflow transitions
issue.setCustomFieldValue(customField2, issue.getCustomFieldValue(customField1))
// for listeners
((MutableIssue) event.issue).setCustomFieldValue(customField2, issue.getCustomFieldValue(customField1))
ComponentAccessor.getIssueManager().updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)
Mark, I'm confused why this cannot be done by a simple post function? Maybe I missed the question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
thanks for the answers. interesting I don't have that option. i'm using jira service desk server - no addons.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe that post function is part of the JSU add-on.
https://marketplace.atlassian.com/apps/5048/jsu-suite-utilities-for-jira?hosting=server&tab=overview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Outofthebox?
Jira v7.8
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure. You simply add a post function to your WF transition to copy the field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mea culpa....cloud has it but i'm guessing server does not. :-(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.