Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

check single-user field is empty or not then update assignee to single-user field

Jessy Li January 31, 2016

Hello, I have a field called Bug Examiner. Can I do post action in transition that 1.check if the bug examiner is not empty, then update assignee?

1 answer

0 votes
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2016

Here it is:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField

if(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Bug Examiner").getValue(issue) == null){
    //Set new asignee
    issue.setAssignee(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser());

    //store changes to database
    ComponentAccessor.getIssueManager().updateIssue(ComponentAccessor.getJiraAuthenticationContext().getUser().getDirectoryUser(), issue, EventDispatchOption.ISSUE_UPDATED, false)
}

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, rovo agent workshop, build a rovo agent, interactive workshop, Atlassian Intelligence, rovo agent building, automated triage, ai agents, cloud app development, atlassian learning, rovo studio, developer productivity, Rovo workshop

Let's build A Rovo Agent 🤖

Want to build your own Rovo Agent? Join this interactive workshop and dive into a powerful Rovo use case: improving resolution time with automated triage.

Save your spot
AUG Leaders

Atlassian Community Events