Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to populate script field with information from Link ticket

rikkin patel June 27, 2016

Hi, 

I am trying to auto populate fields A, B, and C on Ticket-123 with information from a linked Ticket-789. Is it possible using script field?

Best.

4 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
JamieA
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.
June 27, 2016

There is a full example of this in the docs: https://scriptrunner.adaptavist.com/latest/jira/recipes/scriptfields/workRemainingInLinkedIssues.html - including a mitigation for the issue Nic mentioned.

0 votes
rikkin patel June 27, 2016

@Nic Brough @Steve

What if I create a costume field on the current issue to manually capture the linked ticket number and then have the scripted fields reference the costume field to pull in the associated info? 

In-regards to the indexing, my instance is setup to restart and auto re-index every night, hopefully that should help resolve the updated info issue.  

rikkin patel June 27, 2016

@Nic Brough [Adaptavist] @Steven Behnke

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2016

I think you've misunderstood - it does not matter that the scripted field is on issue A.  If the data on the other end of a link changes, issue A has no way to know that.

>n-regards to the indexing, my instance is setup to restart and auto re-index every night,

That is an utterly terrible thing to be doing.  Why would you do something that broken?

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 27, 2016

Yes, it is possible - a scripted field can iterate over the links on the current issue, then go read the issue at the other end of the link.

There is a problem though.  Although it's not quite this simple behind the scenes, you can think of a scripted field as being calculated when an issue is indexed (i.e by an update or a re-index).  The field you are proposing to build has a problem - when the current issue is updated, it'll read all the links and fill in your field.  But when the issues are updated at the other end, the field will not be updated because the current issue is not the one being changed.  You'll need to write listeners that can trigger indexing on every single possible change.

Steven F Behnke
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.
June 27, 2016

You can turn off the caching in the Script Field to mitigate this effect, but I've heard it has performance implications. 

0 votes
rikkin patel June 27, 2016

@Jamie Echlin [Adaptavist]

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events