I need to clear assignee field in JIRA using script runner custom listener.
I wrote the below script to listen to field "Assigned Workgroup" when it is updated then I want to clear Assignee field
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp
import groovy.time.TimeCategory
import java.time.*
def issue = event.getIssue()
def issueKey = issue.getKey()
def issueInputParameters = issue.getAssignee()
def date1 = new Timestamp(new Date().getTime())
def date2 = new Timestamp(new Date().getTime() - 5000)
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def change = changeHistoryManager.getChangeItemsForField(issue, "Assigned Workgroup")
String KISH = change.findAll{it.created < date1 && it.created > date2}
if (KISH == '[]'){
return null
}else{
issue.setAssignee(null) - This line throws error saying "check if declared type is right and if the method exists"
}
Try to run the script. I think it is just a static compilation error. If you run it, then it should work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Srikanth Kola @Alexey Matveev
I have same requirement When ever the Group Picker field is changed or updated or Empty
Then make assignee field as EMPTY (Unassigned) on issue
So i used the above script in the script listener so issue update even for me its not working
can you please help me how to make it work
Thanks,
Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.