Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Update a custom field before creating the issue

Hello.  I'm using Jira Data Center v8.20.

I'm trying to update a custom field (project picker drop-down box) using either Behaviors or a listener (doesn't matter which one).

The catch is, I'm trying to update the field BEFORE hitting the Create button to actually create the issue.

It seems the Behaviors allows me to update a field BEFORE actually creating the issue only  if the field is a system field, not a custom field.  (With Behaviors, I'm able to write a script that updates the Description field, a system field, upon opening my 'Create' screen.)

Details what I'm trying to do:

On my 'create' screen, I have a custom field of type 'Project Picker (single project).'  Currently, when I open the screen (by selecting 'Create' issue), the field is populated with all the projects in my Jira environment.  I would like the field to be populated with only the projects to which the 'reporter' (another system field) belongs.  The scenario may help make more sense of this.


Add user to my project (Jira project)

- My Projects (the project picker drop-down field on project Add user to my project)

- Mark and John (2 Jira users)

- User Mark owns Jira projects Mark1 and Mark2

- User John owns Jira projects John1, John2, and John3

- Mark needs needs to make a new user (Tom) a member of his project (Mark1) by adding Tom to a group associated with project Mark1.  Mark clicks the Create button on project Add user to my project (NOTE:  This 'Create' button only opens the screen/form.  It doesn't actually create the issue.)  Mark clicks the My Projects drop-down field to select project Mark1... --> Mark's projects (Mark1 and Mark2) are listed, but so are all of John's projects (John1, John2, John3).  The Behaviors or listener script should populate the My Projects field with only Marks projects.  Mark should not be able to see (and have to option to update) John's projects.

Again, this should take place BEFORE the issue is created.  At this point, there is no issue, so no issue.My Projects (syntax here may be wrong, but you get my point) can be used in the script at this point.

If anyone knows of a way to tackle this, I'd really appreciate the suggestion.

Thank you!


1 answer

0 votes

Welcome to the Atlassian Community!

This script is for custom fields of type "select list", but the project picker field type is a select list, so it should work the same way:

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events