Hi all,
I was wondering if anyone has ever had to hide components based on issue type. I know that this question is most likely a duplicate of https://answers.atlassian.com/questions/128050/how-to-create-components-based-on-issue-type
but I wanted to know if I can hide specific components via Javascript or the behaviours plugin...
Anyone has ever done sth. like this?
Thanks for any hints,
Christian
I think you can... you can remove components from the available selection so you should be able to do that based on issue type.
How would I remove them...Maybe you could point me to the right direction. Would that be close to what youre describing in your example
on your example page?
https://jamieechlin.atlassian.net/wiki/display/JBHV/Miscellaneous+Behaviours+Examples
Based on issuetype you can set options to the component field , refer this similar example for setFieldOptions() . The map for component field options will contain [id:name]
Jamie
I am using above code to set Custom field - Applications based on Component in JIRA 6.0.2
I am getting below errors: can you pls guide me what could be issue here?
,807 http-bio-9000-exec-19 ERROR 570x161444x1 l5xrx1 197.1.18.83 /secure/QuickCreateIssue.jspa [groovy.canned.utils.ConditionUtils] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:Script28.groovy: 2: unable to resolve class FormField @ line 2, column 15. FormField formComponent = getFieldById(fieldChanged) ^Script28.groovy: 3: unable to resolve class FormField @ line 3, column 15. FormField formApplications = getFieldByName ("Applications") ^Script28.groovy: 29: unable to resolve class GenericValue @ line 29, column 22. GenericValue component = componentManager.getProjectManager().getComponent(Long.parseLong(componentId)) ^3 errors
Hi Raj,
I presumed you have missed out the imports:
import org.ofbiz.core.entity.GenericValue
import com.atlassian.core.ofbiz.util.OFBizPropertyUtils
Hi guys,
For my case, the subcomponent field does not reflect. Here is my code:
public void setSubComponentOptions () {
FormField formComponent = getFieldById(fieldChanged)
FormField formSubcomponent = getFieldById("customfield_10901")
Object componentFormValue = formComponent.getFormValue()
List componentIds = []
if (componentFormValue instanceof List) {
componentIds.addAll(componentFormValue as List)
}
else {
// could be an empty string if all components are deselected
if (componentFormValue) {
componentIds.add(componentFormValue)
Map fieldOptions = [:]
fieldOptions.put ("-1", "None")
for (Long componentId : componentIds) {
try {
Long.parseLong(componentId)
} catch (NumberFormatException e) {
log.error ("Could not get component Id as Long")
return
GenericValue component = componentManager.getProjectManager().getComponent(Long.parseLong(componentId))
switch (component?.get("name")) {
case "Network Issue" :
fieldOptions.putAll (["11201":"SAP"])
break
formSubcomponent.setFieldOptions (fieldOptions)
Appreciate your help.
Regards,
MG
It looks like you're new here. Sign in or register to get started.