Hi,
In the workflow, add the postfunction "Assign to Reporter" at create tranistion (Assuming the creator is always same as reporter)
Regards,
Chaithra
You can use the Script Runner plugin and the following simple scripted postfunction
Condition:
!issue.assignee
Script:
issue.assignee = currentUser
as part of the create transition. If the user doesn't change the assignee, the issue is assigned to the current user. If it's changed, the assignee choosen by the user is the assignee.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Henning,
i'd like to implement your suggestion but I am pretty new to script runner. Can you give me a more step by step help to implement this?
Thanks
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Enter inline script
if (!issue?.assignee) { issue.assignee = currentUser }
Click on "Add"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
thanks a lot for comming back to me. I tried it but i cannot find an option for entering an inlin script. I can preselect some options or define a path to a script. How do I enter an inline script?
Thanks
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
in my version there is a (dark blue) inline script field. Did you follow the instructions step by step?
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
I did it step by step, but i do not see a dark blue inline script field.
I run JIRA version 6.0.8
Script Runner 2.1.15
Is there maybe some additional configuration within script runner nessecairy?
Thanks
Thomas
Capture.PNG
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thomas,
in your Script Runner version you have to create a script file on your server (e.g. AssignToMeIfUnassigned.groovy) and enter the path to this file (incl. file name) within the field "Script file path". The content of the script file is the same as the inline script above.
Thanks,
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All!
I also need to do reporter = assignee.
I did this step by step and the task was created unassigned.
Should I change smth in it?
if (!issue?.assignee) {
issue.assignee = currentUser
}
Enter inline script
if (!issue?.assignee) {
issue.assignee = currentUser
}
Click on "Add"
What did I do wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try
if (!issue?.assignee || issue?.assignee == "-1") {
issue.assignee = currentUser
}
as inline script.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, it doesnt work also and I have a log on it
Time (on server): Thu Apr 12 2018 11:27:11 GMT+0300 (Russia TZ 2 Standard Time)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2018-04-12 11:27:11,117 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2018-04-12 11:27:11,117 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> groovy.lang.MissingPropertyException: No such property: currentUser for class: Script1591 at Script1591.run(Script1591.groovy:2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, ok, than this:
import com.atlassian.jira.component.ComponentAccessor
if (!issue?.assignee || issue?.assignee == "-1") {
issue.assignee = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser()
}
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Henning, thank you , but it also doesnt work.
During pasting the script there were errors. and log on it
2018-04-12 11:51:20,022 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2018-04-12 11:51:20,022 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> groovy.lang.MissingPropertyException: No such property: ComponentAccessor for class: Script1606 at Script1606.run(Script1606.groovy:2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you forgot the first line, the import in the script (import com.atlassian.jira.component.ComponentAccessor).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you are right, sorry,
but it doesnt assigne task to me ((
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And log
2018-04-12 12:43:13,617 ERROR [workflow.ScriptWorkflowFunction]: ************************************************************************************* 2018-04-12 12:43:13,617 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script> groovy.lang.MissingPropertyException: No such property: ComponentAccessor for class: Script1606 at Script1606.run(Script1606.groovy:2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mmmh. Did you publish the workflow after the last change? The row number for the error is still 2 ("...at Script1606.run(Script1606.groovy:2)", so the import row seems still to be missing,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I published it after changing. Thank you very much for your help and your time and your responsiveness!!!
And could you please help me to change script with some conditions
Assign issue to reporter by default,
but if other assignee is selected during the creation of the task, assign issue to the other assignee..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does it work now?
For the condition please try
import com.atlassian.jira.component.ComponentAccessor
import webwork.action.ServletActionContext
def assignee = issue?.assignee
def request = ServletActionContext.getRequest()
if (request) {
def values = request.getParameterValues('assignee')
if (values && values.size() == 1) {
assignee = values[0]
}
}
if (!assignee || assignee == "-1") {
issue.assignee = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser()
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I added some logging, please try this and report back the log entries.
import com.atlassian.jira.component.ComponentAccessor
import webwork.action.ServletActionContext
def assignee = issue?.assignee
log.error "assignee: $assignee"
def request = ServletActionContext.getRequest()
log.error "request: $request"
if (request) {
def values = request.getParameterValues('assignee')
log.error "values: $values"
if (values && values.size() == 1) {
assignee = values[0]
log.error "assignee: $assignee"
}
}
if (!assignee || assignee == "-1") {
issue.assignee = ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser()
log.error "assignee changed to ${ComponentAccessor.jiraAuthenticationContext?.getLoggedInUser()}"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just wanted to say this still works in 2019 on 7.13, will test on Jira 8 soon. Thanks @Henning Tietgens !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
They can also just click the assign to me link underneath the Assignee dropdown box. Then both your workflows are possible.
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.