When create issue screen populated, Assignee contains "Automatic". Instead it should be populate the current user or the reporter (both are same).
I am using script runner.
I tried with behaviours; could not get thru.
Anyone can help?
Hello,
Try to use a code like this:
import com.atlassian.jira.component.ComponentAccessor import com.onresolve.jira.groovy.user.FieldBehaviours import static com.atlassian.jira.issue.IssueFieldConstants.* import groovy.transform.BaseScript def assignee = getFieldById(ASSIGNEE)
def reporter = getFieldById(REPORTER) assignee.setFormValue(reporter.getValue())
Thanks Alexey! It works like a charm.
I written only last 3 lines. and did not have a clue, which object is available in which package (to import)..
Any idea, where i can start learning on these? any knowledge base links.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can find more info here:
https://scriptrunner.adaptavist.com/5.4.12/jira/behaviours-overview.html
If you have any questions, just ask :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, Can anyone suggest more recent code version, Scriptrunner throws errors when i try to use code versions above
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am running this as a post-function via ScriptRunner but it is not setting the assignee for some reason:
if(issue.assignee == null){
issue.setAssignee(issue.reporter)
log.info("post assignee " + issue.assignee)
}
My log output comes back with 'post assignee THE RIGHT VALUE', but it is not reflected in Jira when I open the issue.
This seems so simple but not working, any help would be greatly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Currently am using below script:
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.atlassian.jira.issue.IssueFieldConstants.*
import groovy.transform.BaseScript
def assignee = getFieldById(ASSIGNEE)
def reporter = getFieldById(REPORTER)
if( assignee.getValue() == "-1" || assignee.getValue() == "")
{
assignee.setFormValue(reporter.getValue())
}
But it does not work for sub-sequent launches. if i cancel the "create issue" screen and re-launch it then assignee shows as "automatic" only.
It works only if i complete the issue creation successfully.
Any idea, how to enforce this to work every time.
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.