I have a requirement where I need to update the value of a custom field in a project when the issue in another project(B) transitions from fulfillment to done.
The catch here is, the value that needs to be updated is stored in another project.
So basically when a issue is created in Project 'B', it has linked project project and linked issue mention, I need to get the value [bugdet value] from the linked issue[this is from another project] and update it in the linked project
Is this possible using the rest API? or another ways? I am quite new with the development Zone in JIRA and would like to understand if this is feasible?
Thanks,
Hi Nir,
Thank you for your response. Could you please let me know with the intial logic or steps that I should start with?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, i will just give you some points.
In your workflow create a post-function of type scriptrunner in the transition you want.
In the script, you should get your linked issues with :
issueLinkManager.getOutwardLinks(issue.getId()).findAll { it.issueLinkType.name.contains("Epic")}
try "getOutwardLinks" or "getInwardLinks", change "Epic" to your link name.
once you get your links, you can get your issue in another project from it.
Once you get the issue from another project, update it's customfield like this:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def myCustomField= customFieldManager.getCustomFieldObject("customfield_11111") //replace 11111 with the id of your customfield
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
def customFieldValueInCurrentIssue = issue.getCustomFieldValue(myCustomField)
myCustomField.updateValue(null, issue, new ModifiedValue(issueInAnotherProject.getCustomFieldValue(myCustomField), customFieldValueInCurrentIssue), changeHolder);
Hope you can manage work with this.
I wrote you all the hard parts, the rest is easy
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.