Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use Behaviours plug-in to auto-fill a custom field with the current user at creation.

We have a field called "Incident Owner" that we want to pre-populate with the current user's name on the create screen. 

We have Adaptivist's Behaviours plug-in, but I'm having difficulty putting together an Initialiser that works. 

Any help would be much appreciated!

1 answer

1 accepted

1 vote
Answer accepted
brbojorque Community Leader Dec 18, 2019

Please try this and let me know if it works.

import com.atlassian.jira.component.ComponentAccessor

def incidentOwner = getFieldById("customfield_12345")

def
 currentUserObj = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

incidentOwner.setFormValue(currentUserObj.name)

That did it! Thank you so much!

Like Andrew Zimmerman likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you