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

Hi All, I am looking for a script where i want to change the status of Issue on the basis of linked

Hi All,

I have 2 projects one is Dev and the other is Release project .

I am looking for a script where -

I want to change the status of a Issue in Release project once all the linked issues which are DEV issues are closed.

I have tried different sample scripts but it does not seems to be working . Also please let me know do we have to write a script listener for this.

 

2 answers

0 votes
Ravi Sagar Community Leader May 07, 2021

Hi @shrikant maheshwari 

Share your script, let us try to fix it.

Few things to note.

  • You have to fetch the linked issues based on the type and most importantly the direction. Inward or Outward links.
  • When you transition the issue, make sure there is a relevant transition in those issues.

There are plenty of script on our script library: https://library.adaptavist.com/

Ravi

@Ravi Sagar  Hi Ravi,

please find the below script -

The below script is not updating the status of the destination issue.

  • Suppose I Have Issue A and Issue B , Issue A is in Source Project and Issue B in Destination Project
  • and Issue B, "Is Blocked By" Issue A then as soon as the Issue A is closed the Issue B should also be closed. 
  • I have placed the below script in the post function of Closed status of Issue B

But still the status of Issue B is not getting Updated as soon as the Issue A gets closed.

import com.atlassian.jira.issue.link.LinkCollectionImpl;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.issue.IssueInputParametersImpl

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
IssueService issueService = ComponentAccessor.getIssueService()
def actionId = 31
def transitionValidationResult
def transitionResult

List allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());
for (Iterator OutIterator = allOutIssueLink.iterator(); OutIterator.hasNext();) {
IssueLink issueLink = (IssueLink) OutIterator.next();

def linkedIssue = issueLink.getDestinationObject().id
transitionValidationResult = issueService.validateTransition(currentUser, linkedIssue, actionId,new IssueInputParametersImpl())
if (transitionValidationResult.isValid()) {
transitionResult = issueService.transition(currentUser, transitionValidationResult)
if (transitionResult.isValid())
{ log.debug("Transitioned issue $issue through action $actionId") }
else
{ log.debug("Transition result is not valid") }
}
}

Ravi Sagar Community Leader May 10, 2021

Hi @shrikant maheshwari 

Is the action id 31 valid for the target issue? Use Script Console to first check if the direction of the link is correct. The code above will get your outward links. Also how are you triggering the issues to be transitioned in your target project? Using a post function. The code above is not checking whether all the issues of a specific type (common release for example) in your source project are closed or not.

Break down your script to

- To get correct issue link direction

- Check if other issue in the release are closed or not

- Check for the relevant action id in your target issue's workflow

I hope it helps.

Ravi

@Ravi Sagar 

Hi Ravi,

The transaction id 31 is valid for the Target Issue. And i have placed this script in the post function of the Target Issue. Also there are no other issues linked to Target Issue.

SO the scenario is 

Source Project - A , ISSUE A

Destination Project -B, Issue B

Now Issue B is "Is blocked by" Issue A i.e Issue A "Blocks" issue B and as soon we close Issue A the Issue B should also be closed.

Could you please help in changing the script ?

0 votes
Daniel Ebers Community Leader May 15, 2021

Hi @shrikant maheshwari

from reading your requirement using feature fast-track transition from Script Runner could be an alternative.

I found a similar discussion which might be helpful:

Regards,
Daniel

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

322 views 9 7
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