Hi,
I'm new to Script Runner and Groovy and I'm trying to transition issue if Assignee field was changed from "Unassigned" not from "someone" to "someone"
I'm using Script Runner Listener for Jira (Fast-track transition an issue)
For now, my configuration looks like:
Events: Issue assigned
Condition: issue.status.name == 'Open'
Action: "Status Name"
The problem is that configuration works also if Assignee field was changed from "someone" to "someone"
Frankly, I don't need to specify the status name in the condition field. I need to fire the script only if Assignee was Unassigned.
Thank you for any suggestions
Hi Sam,
So if you want a condition that it will return true only if the assignee changed from unassigned to someone else then the script for that should be
import static com.atlassian.jira.issue.IssueFieldConstants.*
def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == ASSIGNEE}
change && ! change?.oldstring
Hope that helps,
Thanos
Thank you Thanos! I will check your solution soon.
I got also the solution from Aidan [Adaptavist]
import com.atlassian.jira.component.ComponentAccessor //Grab necessary Componentsdef changeHistoryManager = ComponentAccessor.getChangeHistoryManager()//Get last changed itemdef lastChangedItem = changeHistoryManager.getAllChangeItems(issue)[-1] //Looks at end of list if(lastChangedItem.froms == [:]){ return true}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Time to up your Loom game! The new Loom Essentials Certification is here! Show off your skills, learn pro tips, and get officially recognized. Perfect for taking your video messaging to the next level.
Learn moreOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.