Dynamic fields in Jira

Hello everyone!
I want to change some value in Jira custom field(list type) but get an error “Specify a valid ‘id’ or ‘name’ for Responsible team”. I use update operation, choose field Responsible team and put in value next field json - { "fields": { "customfield_10118": {"id": "10893"} } }
Also tried {{ {customfield_10118: 10893} }} and {{ [{"customfield_10118": "10893"}] }}.
But it just returns me mentioned above error. I tried different ways but the result is the same.
Could someone clarify what I do wrong?
Thanks in advance.

Hey @Denis_Volnov,

Welcome to the community :tada:

Does it work if you select the field from the dropdown list and for the ID just input the number 10893? It looks like Jira is returning the message about the ID being invalid though which makes me wonder if that is the value it is expecting or if the ID is some longer string or a friendly name.

Hey @jon,
Thank you!

Do you mean this?
if yes, it also returns the same error. I tried in many ways. With " / { [ in different combinations but still nothing

That is the one, so the next thing will be making sure the id / value is correct as it is Jira saying it is incorrect so we don’t really have a lot of control over that one.

Does using the name work?

I’ve tried with name as well. Nothing.

Screenshots from Postman where I got all Jira fields. So, they are right

That is very strange, the problem here is Jira is saying the value is wrong but if that postman data is correct it should be working.

If you use postman to make the same api call to do the update does that work?

I don’t think the Jira node supports this yet. It sends the request in the wrong format for complex fields, the field body should use and id key instead of value. This was the reason for my PR ✨ Add Jira raw JSON field for advanced users by pemontto · Pull Request #2435 · n8n-io/n8n · GitHub.

You can see some of the various formats customfields take in this example request - https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

Edit: the reason it’s merging raw JSON was because trying to support dynamically loading an arbitrary number of customfields with different input requirements was beyond me, and potentially the current properties system

1 Like

Hey all, I played around with this for a bit and it seems I can send custom payloads to Jira just fine when using expressions.

Having configured a custom field in Jira like so:

I was first retrieving an example issue including this field which would look like so:

I am then able to use this syntax when creating a new issue like so:

The exact expression I have used in this example was {{ [ { "self": "https://n8nsupport.atlassian.net/rest/api/2/customFieldOption/10021", "value": "Option 2", "id": "10021" } ]}}. After running the below workflow, my custom field is populated as expected:

Not sure how exactly your field has been configured @Denis_Volnov, but perhaps it’s worth a shot looking at the exact structure provided by Jira when fetching an issue including this field? And then re-creating this structure when updating/creating an issue?

1 Like