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
Hi guys,
For my case, the subcomponent field does not reflect. Here is my code:
import org.ofbiz.core.entity.GenericValue
import com.atlassian.core.ofbiz.util.OFBizPropertyUtils
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raj,
I presumed you have missed out the imports:
import org.ofbiz.core.entity.GenericValue
import com.atlassian.core.ofbiz.util.OFBizPropertyUtils
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you can... you can remove components from the available selection so you should be able to do that based on issue type.
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.