Hi,
I have tried to inlclude javascript code and doesnt work. Any idea of how do it by using groovy script in Behaviours?
Hi again,
Im trying to use the following script in Behaviours:
import com.onresolve.jira.groovy.user.FormField FormField f = getFieldById(getFieldChanged()) FormField comps = getFieldById("components") comps.setReadOnly( (f.getValue() as Boolean))
where f is a custom field of type text field and components is the default system field.
Im allways getting the following error in the log file:
2012-03-21 08:16:09,971 http-8090-1 ERROR admin 496x189x1 pfrjrf 127.0.0.1 /rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/runvalidator.json [onresolve.jira.groovy.BehaviourManagerImpl] Something went wrong with method run in class java.lang.NumberFormatException: For input string: "fdgdfgd"
It seems that f require a number but it is a text field. Please help
Jira version 4.4.1 and plugin version 0.5.0
When I include the ! simbol in the condition it seems that works...but i get exactly the reverse effect
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of jira and what of version of the plugin?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, im going to explain it better:
I want to set components field as readonly when other text custom field is not empty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's no description of what you are trying to do. Is it set the components readonly if some other field is empty, or the converse? And what type of field is the other field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let's say my select field is called SelectListA, when it's empty I want the components to be writable, otherwise readonly:
OK, here it is
def isEmpty = getFieldByName("SelectListA").getFormValue() != "-1" // // -1 is None def components = getFieldById("components") components.setReadOnly(isEmpty)
If the other field is not a select list then use:
def isEmpty = getFieldByName("SomeTextField").getValue()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! Now it works
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For me, this issue was related to trying to use the getValue() method instead of getFormValue(). I'm not sure if this is due to the fact that it's a custom field, or if it's a custom field that is of type Numeric Field. This wasn't working for me:
FormField fieldSummaryFlag=getFieldById("customfield_11210") FormField fieldSummary=getFieldById("summary") if (fieldSummaryFlag.getValue().toInteger() == 1) { fieldSummary.setReadOnly(true) }
but this did work for me:
FormField fieldSummaryFlag=getFieldById("customfield_11210") FormField fieldSummary=getFieldById("summary") if (fieldSummaryFlag.getFormValue().toInteger() == 1) { fieldSummary.setReadOnly(true) }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've been trying the previous answer and it seems to work fine in the create issue screen but when I got ot the edit issue screen, it doesnt work and I get the following message in the log file:
No option found for customfield_18500 with value 12233
Somebody knows what to do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm having the same issue. Anyone ever figure out why it seems to be getting the field, but trying to get the value throws an exception with the "No option found for customfield_xxxxx with value xxxx" ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes you are right but i need to set it as disabled just when other field is empty. Ideas?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes you are right but i need to set it as disabled just when other field is empty. Ideas?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can write a script to set it to readonly when the other field is empty, using the behaviours plugin.
FormField f = getFieldById(getFieldChanged()) FormField comps = getFieldById("components") comps.setReadOnly(! (f.getValue() as Boolean))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried this code but it doesnt work. Concretely I have this code associated the field IS (getFieldChanged):
import com.onresolve.jira.groovy.user.FormField
FormField f = getFieldById(getFieldChanged());
FormField comps = getFieldById("components");
comps.setReadOnly(f.getValue() as Boolean);
I get an IllegalArgumentException.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can even use Behaviours plugin to make a field Read-only .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.