The following are examples on how to interact with issue picker custom fields within Jira automation.
To Edit Issue Picker Customfields it is necessary to use the ‘Additional fields’ under ‘More options’ in the 'Edit issue' component.
The code snippets for each example should help you getting the syntax right. Please update the customfield ids according to your needs.
Set Issue key(s) to Issue Picker
In this example we want to set the 'customfield_10197' to “KAN-10”.
Alternatively you can also set multiple selected issues at once.
For Single Issue:
{ "fields": { "customfield_10197": ["KAN-10"] } }
For multiple Issues at once:
{ "fields": { "customfield_10197": ["KAN-10","KAN-11"] } }
Append one selected issue to already existing selected issues
In this example we want to add the issue key “Kan-100” without overwriting current selected issues in the issue picker field ‘customfield_10107’.
{ "fields": { "customfield_10107": [{{#customfield_10107}}"{{.}}",{{/}}"KAN-100"] } }
Copy Issue Picker Fields
In this example we want to copy the selected issues from ‘customfield_10192’ to ‘customfield_10197'.
{ "fields": { "customfield_10197": [{{#customfield_10192}}"{{.}}"{{^last}},{{/}}{{/}}] } }
Use current attributes of selected issue in the Issue Picker
Recommanded only for single select Issue Picker. Otherwise we would need to differentiate the selected issues via JQL further.
In this example we want to set the issue’s assignee based on the current assignee in the selected issue of issue picker field ‘customfield_10107’.
Syntax: Lookup issues
key in ({{issue.customfield_10107}})
Syntax: Edit issue fields (Assignee)
{{lookupIssues.first.assignee}}
Please check Atlassian’s documentation on ‘Lookup issues’