Tried to hide a numeric custom field with the Script Runner behaviour addon:
2015-09-18 14_29_16-Behaviours - JIRA.jpg
The script is:
FormField fieldFF = getFieldById("customfield_14401") { fieldFF.setHidden(true); }
Although i added the mapping to the correct projet this is not working, any ideas what is wrong here?
Thanks & regards,
Hans-Hermann
Community moderators have prevented the ability to post new answers.
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.ComponentManager
import groovy.transform.BaseScript
import static com.atlassian.jira.issue.IssueFieldConstants.*
@BaseScript FieldBehaviours fieldBehaviours
def A= getFieldById("customfield_10109")
def B = getFieldById("customfield_10120")
def C = getFieldById("customfield_10018")
def D = getFieldById("customfield_10019")
def E = getFieldById("customfield_10201")
def F = getFieldById("customfield_10124")
if (A.getValue() == "aaaaa"){
B.setHidden(false);
C.setHidden(false);
D.setHidden(false);
E.setHidden(false);
}
else {
B.setHidden(true);
C.setHidden(true);
D.setHidden(true);
E.setHidden(true);
}
can you please provide the code of how can i hide the field upon a user/group or role.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there,
a full reindex during the weekend didn´t change anything, so still very interested in getting this up&running...
Best regards,
Hans-Hermann
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i tested it several times and checked Ids etc, but no success:
2015-09-18 15_10_24-Custom Fields - JIRA.jpg2015-09-18 15_10_55-[SBX-998] Test Update Attachement from Confluence - JIRA.jpg2015-09-18 15_12_10-Behaviours - JIRA.jpg
Also tried
FormField fieldFF = getFieldById("customfield_14401") fieldFF.setHidden(true);
but without any changes.
@Jamie Echlin [Adaptavist]: Tried both being assignee and unassigned, but no change. Please mind the error message that the field cannot be hidden based on the UI settings due to your documentation as it´s from type "Number"...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's only hidden in the edit screens. The exceptions are the two "hideable" fields that are implemented, which are just short and long string. That's what the message is telling you. I can add an RFE to add other types of hideable field. But you can possibly remove it from the View Issue screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, currently the field is also shown on the edit fields unregarding who is the assignee...?! Removing from View Screen is no option as some user groups should see this field and others not. Beside an paid addon i didn´t find any option to realize this feature, hope i could do that (as many other stuff) with your plugin...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am guessing that the syntax of your behavoiurs script is incorrect. I don't know what actually were you trying to do, use na open code block or an annonymus closure, but for such simple script you don't need it so try:
FormField fieldFF = getFieldById("customfield_14401") fieldFF.setHidden(true);
if you necessarily need an closure then use it right: declare AND invoke, for instance:
FormField fieldFF = getFieldById("customfield_14401") {it-> fieldFF.setHidden(true); }.call()
or using open code block label it:
FormField fieldFF = getFieldById("customfield_14401") L:{ fieldFF.setHidden(true); }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not sure why it's in a block... you have clicked Hidden in the UI, so it should be hidden when the current user is the assignee. You don't need any script here.
Is it hidden in the UI?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.