I am working on creating work items in an epic using automation. The epic has a custom field "Matrix" that is a multi-select. For each selection we make a new work item using a branch. That is working fine. I've set the variable name as Matrix.
I need to set the matrix custom field in the newly created work item to be the single matrix value used to create the work item from the "For Each:", rather than all that are listed in the epic's field. I think I need to use the the additional fields box, but I'm unsure of the appropriate JSON syntax. I get an error message when using the below option.
Hello @Molly Hopper
First, when creating a variable it is best to use a name for the variable that does not match any field name to avoid confusion about whether you are the reference is trying to get data from the field or from the variable. I like to preface my variables with "var"; i.e. varMatrix.
Second, there is a reference document that shows how to use JSON to set a variety of field types. For a Select List field the format is:
{
"fields": {
"customfield_11449" : { "value": "option3" }
}
}
So for your case it would be (with the variable name change I recommended):
{
"fields": {
"Matrix" : { "value": "{{varMatrix}}" }
}
}
Give that a try and let us know if it works.
Updated as specified, and I'm getting errors when running the rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, yes, my error.
I misread that the "Matrix" field you were trying to set in the new issue was a single select field, but it is actually multi-select. So, yes, you do need the square brackets when setting value(s) in a multi-select field, even if setting just one value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Molly Hopper and @Trudy Claspill
For option fields, the default attribute is the id attribute of the selected option(s). That is, in the Advanced Branch source you show, I would expect that to return the id and not the value attribute...and thus fail in the JSON expression.
If your Work Item Create is still failing for that reason, perhaps change the source for your Advanced Branch to this:
{{issue.customfield_10074.value}}
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.