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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Error in Validator script to check all the linked issues should have status "Verified"

I have this code

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink
import com.opensymphony.workflow.InvalidInputException

IssueLinkManager linkMgr = ComponentAccessor.getIssueLinkManager()

for (IssueLink link in linkMgr.getOutwardLinks(issue.id)) {

log.debug("linked issue type: " + link.issueLinkType.name)
log.debug("linked issue key: " + link.getSourceObject().getKey())
log.debug("linked issue status (name): " + link.getSourceObject().getStatus().getName())
log.debug("linked issue status (id): " + link.getSourceObject().getStatus().getId())

if (!link.getSourceObject().getStatus().getName().contains("Verified")) {
log.debug("issue " + link.getSourceObject().getKey() + " is not in Active state")
invalidInputException = new InvalidInputException("Linked issue is not in a status of Template")
throw invalidInputException
}
}

 

here,.. it should check all the linked issues are in verified state and then change the status of the issue.

All i get is invalid error exception : null.

 

could anyone please help???/

2 answers

1 accepted

0 votes
Answer accepted

I am guessing the exception trace shows the exception is occurring in the for loop condition. (It is a good idea to get the stack trace whenever an exception occurs because it helps with debugging)

You could try this instead as your for loop condition

for(linkMgr.getLinkCollectionOverrideSecurity(<issuekey>).getAllIssues()) 

Hey shivaram,

Try the below code in your validator

int count=issue.getLinkedIssues("Includes").size()
int status
issue.getLinkedIssues('Includes').each{
if(it.getStatus().getName()="Verified")
{status++}

}
if(count==0||count==status){
return true}

else{return false}

I hope this is what your are looking for.

@Aditya_Sastry 

where the issue from?

Suggest an answer

Log in or Sign up to answer
TAGS

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