Is there any way I can loop the value I get from the checkbox/multiple select and use it to determine which project in JIRA for a new issue to be created?
For example something along the way as below:
def checkboxCollection = replica.customFields."Create in the customer facing projects"?.
value?.
collect{
a->
nodeHelper.getOption (issue, "Create in the customer facing projects", a.value)
}
For each (checkboxCollection) {
issue.projectKey = nodeHelper.getProject(replica.project?.key)?.key ?: checkboxCollection
issue.typeName = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "Service Request"
}
We would like to understand closely your requirements about this configuration.
For example:
There are two instances “A” and “B”.
“A” side has a multi-box selection custom field and there are values like: (“V1”, “V2”, “V3”) and they could be selected either in one or a few options, or even 0.
So, we would like to figure out how the B side should understand which project to choose by selected values on the A side? Could you please elaborate about it?
So if the value of remoteCheckboxes from “Remote Checkbox” is (“V1”, “V2”, “V3”), then 3 issues would be created in 3 different projects which are in V1, V2 and V3
How do I make of this? I am not looking to sync the field. I am looking to use the values in the field so I can loop it to determine which project in JIRA to sync my issue to.
I am more than happy to explain more if need better explanation.
Hi Andrii, to top up my previous comment, the reson we use checbox is to be able to select multiply. The script you gave me is good is the selection is single.
We want to be able to select more than one selection and be able to loop it and create project based on it,
I hope this helps. Thanks!
Comments:
Serhiy Onyshchenko commented on 06 August 2021
Hello, Iona Augustine
As far as I understand your use case, you have a checkbox custom field on source side (let’s call it Source for now), the checkbox lists different project keys from Destination side.
A user on Source side is supposed to tick one or multiple boxes in this custom field, and you’d like that Exalate creates an issue on Destination side in each project, right?
Regards, Serhiy.
Iona Augustine commented on 09 August 2021
Hi Serhiy,
Yes! exactly that. So the script will be dynamic with less or no maintenance at all.
This should work, but I am looking something more dynamic, without specifying the value at all.
So if today I have 2 values within the checkbox i.e. Project A, project B, project C. Then tomorrow I added project D, I dont have to modify the script each time.
You can try to create a condition with a revising if your checkbox has been checked or not.
Please notice that if you are sure that in your customfields all the checkboxes have some value, you should use a non-commented condition. If not, you should use the commented one.
Also, please let us know if it worked for you.
if (replica."Create in the customer facing projects".any {box->box.value == "example"})
//if (replica."Create in the customer facing projects"?.any {box->box.value == "example"})
{
issue.projectKey = "example"
}
Comments:
Iona Augustine commented on 14 July 2021
Hi Andrii, anything on this yet? If it’s not possible then it’s OK, we’ll work a workaround.