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

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

"affectedVersion is not EMPTY " is not working

Hi,

If I set Affects versions using edit screen." Project ="XXX" and affectedVersion is not EMPTY " works fine and returns the issue.

But If I used scriptrunner code:

issue.setAffectedVersions(affectedVersion)
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

to set Affected version, the code works fine and I can see the added Affects versions in view screen. But " Project ="XXX" and affectedVersion is not EMPTY "  does not return the issue.

 

Does someone knows what is the problem ?

 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Nilufar It's definitely an indexing issue. Include below code in Script.

import com.atlassian.jira.issue.index.IssueIndexingService

def indexManager = ComponentAccessor.getComponent(IssueIndexingService.class)
indexManager.reIndex(issue)

 Are you using post function to update Affect version field value ?

Thanks

No, I am using automation

Automation for JIRA > Action "Run Script" ,something like this  ?

Thank you @Vikrant Yadav 

It worked fine

Yes , I run script when event triggered. I updated script and it worked fine

Like Vikrant Yadav likes this

Cool! Glad to hear it works for you!

Stay Safe!

Like Nilufar likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

709 views 2 21
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