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

Custom field required in field configuration, when valorize it in creation transition?

Stefano De Gaetano
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.
April 21, 2015

Hi all,

I have a custom field that's required in field configuration of the issue type.

This custom field hasn't a default value, because users are of two type:

  • some of them must choose a value from the options
  • other users must have ever the same value.

 

So I created a postfunction in the create transition of the issue.

The postfunction is BEFORE the "Creates the issue originally" step!

Based on the reporter of the issue, the postfunction set a default value for the custom field or leave it null.

So If the reporter must choose a value, if he doesn't enter a value, the creation fails [OK]

If the reporter must have the same value for the CF, the creation fails with the message:

 

"There were some errors when trying to create this issue" [CF] is required

 

What I'm wrong???

I have to store the value in the posftunction in some way? (I only use the method "issue.setCustomFieldValue(cField, value);" )

Thanks in advance

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2015

When a transition runs, JIRA runs through the process in this order:

  1. Check conditions
  2. Present screen to user
  3. User commits change
  4. Validate input
  5. Post functions

Your setup is "field is mandatory", which is checked in step 4.  So what you're doing "wrong" is not entering the value for the field when it is required.

Your best bet is probably to make the field optional.  Then iwhen someone leaves it blank, it will pass validation and the post-function can run.  You could even add a validator to check their input too

Stefano De Gaetano
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.
April 21, 2015

Thanks a lot... but the must annoying thing is that, if a CF is optional (in my case the CF is a radio button), in the screen is showed the option "None".... :-S

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 21, 2015

How else are you going to leave it empty? There has to be an option for a user to clearly see means "empty"

TAGS
AUG Leaders

Atlassian Community Events