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
There's a couple of ways to do this:
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.
Assuming your custom field is IN your sub-task (and not in its parent issue for example) the code would be as follows:
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fieldName")
ApplicationUser cfValue = issue.getCustomFieldValue(customField)
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.
@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
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event