I have a use case where the project owners want a "disclaimer" message field displayed on issue create to all Jira users aside from those in their Jira user group. It correctly, doesn't appear if one is in the group that doesn't want to see it. However, the disclaimer will display correctly only if one lands directly on an issue create screen for that particular project. Also, if one changes the issue type, or changes to another project and back to the one that wants the disclaimer, it won't reappear.
The behavior is below. I have a log.debug in there that throws the true/false statement in the logfile. It is correctly evaluating whether the disclaimer field should display or not but I still get the "not" displayed when I really want it to as described above.
Any ideas?
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.component.ComponentAccessor
def disclaimWarn = getFieldById("customfield_17206")
def aGroup = ComponentAccessor.groupManager.getGroup("groupBeingChecked")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName()
def inGroup = ComponentAccessor.groupManager.getUserNamesInGroup(aGroup).contains(currentUser)
log.debug "${inGroup}"
if (inGroup) {disclaimWarn.setHidden(true)}
else {disclaimWarn.setHidden(false)}