The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"affectedVersion is not EMPTY " is not working

Nilufar
July 20, 2021

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Vikrant Yadav
Community Champion
July 20, 2021

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

Nilufar
July 20, 2021

No, I am using automation

Vikrant Yadav
Community Champion
July 20, 2021

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

Nilufar
July 20, 2021

Thank you @Vikrant Yadav 

It worked fine

Nilufar
July 20, 2021

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

Like Vikrant Yadav likes this
Vikrant Yadav
Community Champion
July 20, 2021

Cool! Glad to hear it works for you!

Stay Safe!

Like Nilufar likes this
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events