You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
I have a problem and I don't know how to solve it. Maybe you have any ideas?
I would like to automate Jira Workflow and create automatic assignment in some situations to make sure that case is left unassigned.
Let's say I have custom field in Jira Software called Service Team with options like: Logistic, IT, Finance, etc.
For each Service Team I have dedicated person who is responsible for accepting tickets. It's always same person for each Service Team i.e. for Logistic it's Andrew, for Finance it's Jake and so on.
Do you know how I can manage that after workflow transition to a specific state case will be assigned automatically to specific person depends on Service Team custom field value?
I tried with post function but I couldn't find option to make it.
Do you have any advice for me?
Thanks in advance
Hi Wojtek,
There's a couple of ways to do this:
1) Create a scripted post function that will set an assignee depending on your custom field value. This will require a 3rd party addon like ScriptRunner or JMWE.
2) Create an automation rule that will trigger when your issue is transitioned and set an assignee based on your custom field value. Automation for Jira is required for this approach.
3) If your are using Jira Service Desk, then you can do it using standard JSD automation which is available out of the box.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
I am trying to do option 1, as my client has ScriptRunner but does not want to purchase any other add-ons. I am pretty new to using scriptrunner, how would I go about writing the code for this? I can't find it anywhere online
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure thing. Please advise your custom field type and when do you want this to trigger?
Cheers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The custom field is a single user picker. I would like this selected user to be assigned to a sub-task which is created automatically from a post function in a different workflow (I assume this is what you mean by trigger)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Assuming your custom field is IN your sub-task (and not in its parent issue for example) the code would be as follows:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.user.ApplicationUser
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName")
ApplicationUser cfValue = issue.getCustomFieldValue(customField)
if (cfValue){
issue.setAssignee(cfValue)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
}
However, if your subtask is also created via script, the best approach would be to modify that script so the subtask is created already with an assignee set.
Otherwise use the code I provided as a post function for your subtask's 'Create' transition. Make sure you place this post function last.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ivan Tovbinis it possible to create similar script but for a bit complex conditions?
I want to set auto assignment for issue for certain user depending on custom field value (cascade type, two values).
For example, if value = A-a or B-b or C-c etc. assign to user1
if value = D-d or E-e assign to user2
How it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ivan Tovbin how can I do this using option 3?
3) If your are using Jira Service Desk, then you can do it using standard JSD automation which is available out of the box.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ivan,
thanks for your reply. I used your second proposal and it works great. Thanks for your help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Wojtek_Misiarz - Could you please help how to achieve this.
If I create a Jira Issue and select a module and sub-module, can the issue be auto-assigned to a particular user based on the sub-module?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
May I ask you the code of script runner to assign a specific assignee based on custom fields? If it is possible through 'workflow properties', please let me know!!
Thank you for your help!
Best regards,
Jenny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.