You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi Guys,
My behaviour script is set values to fields on creation issue form.
I faced with problem: Assignee field is empty (unassigned) after creation.
What i missed?
My Script:
import com.onresolve.jira.groovy.user.FieldBehaviours
import static com.atlassian.jira.issue.IssueFieldConstants.*
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.user.ApplicationUser
def issueManager = ComponentAccessor.getIssueManager()
def contextIssue = issueManager.getIssueObject(getContextIssueId())
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def epicLinkCf = customFieldManager.getCustomFieldObjectByName("Epic Link")
def linkedEpic = contextIssue.getCustomFieldValue(epicLinkCf) as Issue
def assignee = getFieldById("assignee-field")
def developer = customFieldManager.getCustomFieldObjectByName("Developer")
def user = contextIssue.getCustomFieldValue(developer) as ApplicationUser
if (getBehaviourContextId() == "link-create-blocking") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
getFieldById("issuelinks-linktype").setFormValue("Linked to Testing").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
getFieldByName("Epic Link").setFormValue(linkedEpic.key).setReadOnly(true)
if ((user) != null)
{
assignee.setFormValue(user.displayName)setReadOnly(false)
}
}
Snapshots:
Hi Thanos,
Your solution does not works: now assignee field does not populate on creation form,
PFA:
Hi Сергей,
The id of the assignee field is wrong, and since you already import the IssueFieldConstants (good practice) then
def assignee = getFieldById(ASSIGNEE)
Regards, Thanos
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.