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

ScriptRunner update custom field's value between linked issues, using Parent Link field

I am trying to match a custom field's value from a "Project" issue type into a "Feature" issue type, on update. These issue types are linked via the Parent Link field. 

ie. My custom field is called "Issue Category." If I update that field on the Project issue, I would like all linked Feature issues to automatically update, to match. 

Below is what I have so far...a mix of real code w/ psuedo-code  

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.link.IssueLink


Issue issue = event.issue

def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Issue Category"} // this should grab changes between linked issues, not child issues?

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def field = customFieldManager.getCustomFieldObjects(event.issue).find { it.name == "Issue Category" }
def parentLink = customFieldManager.getCustomFieldObjectByName('Parent Link') // getting the Parent Link custom field
def featureValue = issue.getCustomFieldValue(field)
def issueManager = ComponentAccessor.getIssueManager();
def customFieldValue = issue.getCustomFieldValue(parentLink) // Parent Link field value
def parentKey = (String) customFieldValue
def parentIssue = issueManager.getIssueObject(parentKey) // Parent issue object
def parentValue = parentIssue.getCustomFieldValue(field)


// HERE IS WHERE I NEED HELP!!
if (parentValue == changed) then featureValue = parentValue

 

1 answer

Sorry Judeboy, looks like no can help you out....shout out my adaptivist peeps! 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

66 views 0 3
Read article

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