Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Jira Automation: Setting checkbox values from a delimited text string

Brandon Fish May 14, 2023

Just putting this out there in case someone else is running into the same issue.

I have a form (external to Jira) that creates Jira tickets via email.  While I can set some fields directly (using JEMH), multi-selection fields like checkboxes don't work, so those types form questions typically are just mapped to the description.  My goals was to parse the description and set the appropriate values in the checkbox field.  It was simple enough to isolate the values using .substringBefore and .substringAfter and then creating a list using .split.  But I could never get the checkbox field to update correctly.  I sifted through many answers here that were close, but never quite got there.

Eventually I stumbled upon this:

Converting a CSV string to a JSON object array when JSON Smart Value Functions do not work in an Automation Rule

My data was separated by new lines "\n" inside a table cell and not commas, but it was exactly what I needed.

Set the variable {{formCheckboxes}}

{{description.substringAfter("|*Checkbox*|").substringBefore("|\n|*Next Question").trim().replace("\n","\"},{\"value\": \"").concat("\"} ]").reverse().concat("\" :\"eulav\"{ [").reverse()}}

Then the JSON for the edit was then simple:

{
"fields": {
"customfield_12345": {{formCheckboxes}}
}
}

Hope this helps someone, I was beating my head on the wall.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events