I am trying to create sub-tasks based on custom field checkboxes and need a little bit of guidance on how to setup the post-function and writing the condition.
I have created a custom field called "SAP Access?" with 3 checkbox options, BI/PI/ECP, I'd like to create sub-tasks on the condition that the checkboxes are ticked and auto-assign them.
There are post-task functions written that pre-date me but I have tried to copy the formatting and tailored it. Can I get some feedback on whether below is correctly written?
//Get SAP Access checkbox value
def sapaccesscustomFieldObject = customFieldManager.getCustomFieldObjectsByName("SAP Access?")
//get all values of the custom field
def sapaccesscustomFieldValues = sapaccesscustomFieldObject.getValue(parentIssues)
//loop through values and create sub tasks
sapaccesscustomFieldValues.each { LazyLoadedOption it ->
def sapaccessValue = it.getValue()
switch (sapaccessValue){
case "SAP BI":
assigneIdList.add("User1")
summariesList.add("SAP BI access for new hire")
descriptionList.add("SAP BI access required")
break
case "SAP PI":
assigneIdList.add("User2")
summariesList.add("SAP PI access for new hire")
descriptionList.add("SAP PI access required")
break
case "SAP ECP":
assigneIdList.add("User3")
summariesList.add("SAP ECP access for new hire")
descriptionList.add("SAP ECP access required")
break
}
}