Hi,
I have checkbox field with 3 options and a nfeed field which is populated from a database. My use case: When option 1 is checked i want to show the nfeed field via formField.setHidden(false) and make it required via formField.setRequired(true).
However when i try it, nothing happens but a loading icon at the end of the create form. Only when I remove the line formField.setRequired(true), the field appears. Other customfields work fine with showing and make them required.
Is there a way to make behaviour work with the nfeed field? I'm using Scriptrunner 3.1.4, nfeed 5.4.1 and JIRA 6.4.12
Hi Ja,
I have managed to replicate your issue using Scriptrunner 3.1.4, nfeed 5.4.1 and JIRA 6.4.12.
The reason that the behaviour fails to execute is due to the fact that the nFeed field does not support being made required. This is due to the fact that the field is a field which is programmatically populated from an external data source and cannot have its data updated by a user inside of JIRA.
This means that all you can do is hide and un hide the field based on check box options using the behaviours plugin.
I have enclosed an example script below which shows how you can hide and un hide an nFeed field based on a selected option in a checkbox field.
import com.onresolve.jira.groovy.user.FieldBehaviours import com.onresolve.jira.groovy.user.FormField // Get a pointer to my check box field FormField checkBoxField = getFieldByName("DemoChecbox") // Get a pointer to my nFeed field FormField nFeedField = getFieldByName("DemoNfeedField") // Get the checkbox option value as a String def checkBoxVal = checkBoxField.getValue() // if Option-1 was selected make the nFeed field visible if(checkBoxVal == "Option-1"){ nFeedField.setHidden(false) // if any other option was selected hide the nFeed Field }else{ nFeedField.setHidden(true) }
I hope this helps
Kristian
Hi Kristian,
thanks for the fast answer, now I know I don't have to look for a solution anymore. It's fine for me.
Jan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jan,
Glad I was able to help.
If the answer is useful could you please mark it as accepted incase other are searching for a question similar to this one.
Thanks
Kristian
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.