How to do set value in field waterfall type or double dropdown list in jira groovy

0

GOOD NIGHTS I'M WORKING WITH JIRA 7 AND GROOVY I NEED TO SET ONLY SOME VALUES WHEN I SELECT A DETERMINED ITEM OF THE MAIN COMBO there is an example if in the detection process you select Peer Review by default you must change the parent combo to Docuemental and the child combo should bring all its items that are: > ["- 1": "None", "13005": "Configuration", "13010": "Content", "13011": "Form", "13006": "Incomplete", "13007": "Spelling" , "13008": "Drafting", "13009": "Traceability"] Any idea of how to do it will be well received Thank you in advance.

 import com.onresolve.jira.groovy.user.FormField
 import com.atlassian.jira.component.ComponentAccessor
 import com.atlassian.jira.issue.IssueManager
 import com.atlassian.jira.issue.Issue
 import java.text.SimpleDateFormat
 import java.text.DateFormat
 import com.atlassian.jira.issue.link.IssueLinkManager
 import com.atlassian.jira.issue.link.IssueLink
 import static com.atlassian.jira.issue.IssueFieldConstants.ASSIGNEE

 import com.atlassian.jira.issue.search.SearchProvider
 import com.atlassian.jira.jql.parser.JqlQueryParser
 import com.atlassian.jira.web.bean.PagerFilter

 FormField resumen = getFieldById ("summary")

 FormField NRequerimiento = getFieldByName ("N° Requerimiento")
 FormField NdeTicket = getFieldByName ("N° Ticket")
 FormField sistemaReq = getFieldByName ("Sistema")
 FormField ProcesoDeteccion = getFieldByName ("Proceso detección")
 FormField clasificacion_Observa = getFieldById("customfield_10118")  
 //("Clasificación de la Observación")
 FormField clasificacion_Observa_sub = getFieldById("customfield_10118:1")
 FormField nro_cp = getFieldByName ("N° CP")

 ComponentAccessor componentAccessor = new ComponentAccessor();
 IssueManager issueManager = componentAccessor.getIssueManager();
 def customFieldManager = ComponentAccessor.getCustomFieldManager()
 FormField issuelink = getFieldById ("issuelinks-issues")
 Issue Entregable = issueManager.getIssueObject( 
 issuelink.getValue().toString() );

 String selectedProject = getIssueContext().getProjectObject().getName()

if(getActionName()=="Create"){
if (ProcesoDeteccion.getValue() != null){
    if(Entregable != null){

        if(Entregable.issueType.name=="Software SF" || Entregable.issueType.name=="Entregable SF" || Entregable.issueType.name=="Entregable" || Entregable.issueType.name=="Software")
        {
            def customFieldNRequerimiento    =  customFieldManager.getCustomFieldObjectByName("N° Requerimiento")
            def cfNReque = Entregable.getCustomFieldValue(customFieldNRequerimiento);
            def asignado = Entregable.reporter

            if(cfNReque !=null){
                NRequerimiento.setFormValue(cfNReque.toString())
                getFieldById(ASSIGNEE).setFormValue(asignado.name)
            }else{
                NRequerimiento.setHelpText("El Entregable/Software no tiene N° Requerimiento")
                NRequerimiento.setFormValue(Entregable.getKey())
            }
            if(ProcesoDeteccion.getValue() =="Revisión de Pares" || ProcesoDeteccion.getValue() =="Revisión Interna de Entregable"  || ProcesoDeteccion.getValue() == "Revisión Técnica del Entregable"){
                clasificacion_Observa.setFieldOptions(["11990":"Documental"])     
             if(clasificacion_Observa.getValue() =="Documental"){
                     clasificacion_Observa_sub.setFieldOptions(["-1":"Ninguno","13005":"Configuración","13010":"Contenido","13011":"Forma","13006":"Incompleto","13007":"Ortografía","13008":"Redacción","13009":"Trazabilidad"])  
              }



                }else{
                    clasificacion_Observa.setHidden(false).setRequired(true)
                    clasificacion_Observa.setFormValue(["-1":"Ninguno"]);
                    clasificacion_Observa.setFieldOptions(["-1":"Ninguno","11990":"Documental","11991":"Estándares","11992":"Código","11993":"Funcional","11994":"Despliegue"])

                }


        }
    }

}

}

    
asked by Jose Salazar 09.08.2018 в 01:39
source

0 answers