Hi,
when the issue is transitioned from one status to another then Field value in transition screen should be get clear.
we have Script Runner.
kindly help with script.
Thanks,
Abhishree Nagesh
HI @Abhishree Nagesh ,
Please refer
https://community.atlassian.com/t5/Marketplace-Apps-Integrations/How-do-do-you-clear-a-value-from-a-custom-field-single-select/qaq-p/750567
Adaptavist has provide very good library for most of the scenarios.
https://library.adaptavist.com/
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.ModifiedValueimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def cfm = ComponentAccessor.getCustomFieldManager()def issueManager = ComponentAccessor.getIssueManager()def changeHolder = new DefaultIssueChangeHolder()def cf = cfm.getCustomFieldObject("customfield_XXXX") // CF IDcf.updateValue(null, it, new ModifiedValue(null, ""), changeHolder)issueManager.updateIssue(user, issueManager.getIssueObject(it.getKey()), EventDispatchOption.DO_NOT_DISPATCH, false)
@Abhishree Nagesh Try this one on script post function.
Hi @Sreenivasaraju P
Script is giving me error.
Actually the field is assignee field.
In every transition screen there is a assignee field. So assignee field value should get clear, when transition happens.(I.e in the transition screen field shoukld not take previous assignee name.)
Its giving me error in the last line. please find the snapshot of the error.
Kindly help.
Abhishree
If you want to clear assignee (which is not a custom field), try following on post function.
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.util.DefaultIssueChangeHolderdef issueManager = ComponentAccessor.getIssueManager()issue.setAssignee(null)issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
@Suhas P
we are getting error please find the snapshot for error.
Regards,
@Abhishree Nagesh add following line anywhere before issueManager.updateIssue line
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
By default jira would take previous value in transition screen(assignee).
But if user didnt change the value of assignee when they do the transition then ticket must automatically assign back to reporter.
How to achive this using script runner
kindly provide solution.
It looks like you're new here. Sign in or register to get started.