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

Behaviours support for required fields (not Atlassian custom fields)

Stefano Coletta March 2, 2015

Hello,

I was trying to make a custom field (not Atlassian built-in field, ie. Checklist or Database Custom Field field) required via Groovy by using Behaviours plug-in from Jamie Echlin.

This piece of Groovy code throws a Javascript error and the field remains optional; also Javascript stops running.

formField = getFieldById("customfield_xxxx")
formField.setRequired(true) <---- JS error arises.

If I try this on regular fields like String, Select, etc. everything works fine.

My question is: which field types are supported for setRequired function?

I've noticed that the setHidden() function works even with non Atlassian built-in fields... is there any special requirement to make setRequired() compatible with non Atlassian built-in fields? Or is it a bug?

2 answers

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
JamieA
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.
March 2, 2015

It's just luck of the draw whether it works or not, it depends how closely the generated HTML matches that of the standard custom fields. 

If there was a javascript API for setting field values, making things required etc, it would be a lot simpler. 

So plugin custom fields can be done on a bespoke basis, based on demand, or $$$. 

I think there is already an issue for DBCF fields in https://jamieechlin.atlassian.net/browse/JBHV.

 

0 votes
Stefano Coletta March 3, 2015

Thank you Jamie,

that's really a pity. We are using JIRA even for activities that are not code related, becase JIRA is so flexible that we are trying to use it any way we can to solve general company management problems.

We had the same issue with JIRA Service Desk that, as Behaviours, cannot use Custom Fields at all on the Portals. I've browsed the JBVH project and I've not found the DBCF issue you mentioned. Actually we need support for the following fields, and if the case, we'll open an issue for each of them:

We are extending the interface even with other fields but for now these are the most important ones for us.

 

TAGS
AUG Leaders

Atlassian Community Events