Hi,
I am trying to hide 4 fields ( project lead, design author, contributor and consultant) from the project based on assignee using behaviors in JIRA
I added field under behavior as "Assignee" as optional, writable and shown and then wrote this server-side script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
def assignee = getFieldById("assignee")
def ProjectLead = getFieldById("customField_21153")
def DesignAuthor = getFieldById("customField_21154")
def Contributors = getFieldById("customField_21155")
def Consultants = getFieldById("customField_21156")
log.debug("Assignee " + assignee.getValue())
if (assignee.getValue() == "backlog-server-storage-engines") {
ProjectLead.setHidden(false);
DesignAuthor.setHidden(false);
Contributors.setHidden(false);
Consultants.setHidden(false);
}
else
{
ProjectLead.setHidden(true);
DesignAuthor.setHidden(true);
Contributors.setHidden(true);
Consultants.setHidden(true);
}
This is not working, can someone suggest what am i doing wrong? Thanks
I don't think it's your "set" code - https://library.adaptavist.com/entity/set-behaviour-hidden is the example I start from when wanting to hide fields
I suspect it's the "if" - I don't think the assignee value == "your string" - assignee should really be giving you a user, not a string.
Hi Nic,
Thanks for replying.
How can i check the assignee value in behaviors then if not using ==?
Another thing is, i want this behaviour to check for assignee value in real-time during issue create i.e hide the 4 fields if the assignee is changes from unassigned to "backlog-server-storage-engines" . I am not sure if this will work via behaviour or i need to add a post function?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
By the way, is this really for Cloud? I thought Behaviours was available just on Server/DC instances.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good point, it can't be for Cloud, Cloud doesn't support Behaviours yet. I've removed the misleading tags.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! :)
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.