Linked issues inherit scripted field value.

Július Presinszky April 15, 2014

Hello,

We have a scripted custom field which is calculated depending on values in other custom fields. For sub-task it inherits the value from parrent issue.
code looks like this:

if (issue.issueTypeObject.name == "Sub-task")
{
def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Total Score")
def abc123 = issue.parentObject.getCustomFieldValue(field);
return abc123
} else
{
count the value
return value
}

I want to ask is it somehow possible for linked issues to inherit value of this scripted field? If the value is updated in "main" task it should by updated in all linked issues. Does anybody have a solution for this?

2 answers

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2014
if (issue.issueTypeObject.name == "Sub-task")
{
def inwardIssues = ComponentAccessor.getIssueLinkManager().getLinkCollectionOverrideSecurity().getInwardIssues("Parent Of");
if(inwardIssues.size() == 1) {
  def parent = inwardIssues[0];
  def field =  ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Total Score")
  def abc123 = parent.getCustomFieldValue(field);
  return abc123
} else
{
  count the value
  return value
}
}

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2014

Note I haven't tested the code, so it might require a little tune-up

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2014

Can't you use simular code that checks if the issue has inward link of some type then get the value from the linked issue ?

Július Presinszky April 27, 2014

Can you put here an example how can I check the inward links and then get the value?

Suggest an answer

Log in or Sign up to answer