I've created a manually triggered automation with a user input dropdown field called "Team" (referenced as {{userInputs.team}}) with values "Team 1" and "Team 2" (the names of my Advanced Roadmaps teams).
I want to use the selected value of said dropdown in a "Create issue" action to set the according "Team" field (which for some reason is not available in the "Choose fields to set..." list so I'm trying to set it using "Additional fields" - it is however available on the create screen of the according issue type).
My current "Additional fields" content looks like this:
{
"fields": {
"Team": {
"value": "{{userInputs.team}}"
}
}
}
However, when executing said rule I get the error
The team id "JsonData{data={value=Team 1}}" is invalid. (customfield_10001)
I tried using {{userInputs.team.value}}, {{userInputs.team.data.value}}, {{userInputs.team.asJsonObject.data.value}} and pretty much every single combination of all the functions recommended by the smart value online help. But for some reason I can't find a way to access the actual selected value ("Team 1").
I've tried to use the field in a {{smartValue}} if block and a comparison there seems to work, but the current structure of my automation makes it really cumbersome to use it that way at said position in the automation.
My final goal is to create a manual trigger on Support issues to create and link a bug by only selecting the team and the project to create the Bug in. I solved the project part by using an if/else block on the aforementioned second user input field (since "Project" can't be set programmatically in "Create issue" actions).
For future reference - at least in the current version of Jira I had to set the Team field directly for it to work - as in:
{
"fields": {
"Team": "55063845-50cd-46fa-ba80-7857298897be"
}
}
It works with a lookup table as well (which has to be created within the same automation before said step):
{
"fields": {
"Team": "{{teamNameToId.get(userInputs.team)}}"
}
}
What doesn't work is directly assigning the name of the team:
{
"fields": {
"Team": "Team 1"
}
}
This leads to an internal server error during automation execution.
Hi @Fabien ,
You should use the id of the team:
{
"fields": {
"Team": {
"id": "XXXX"
}
}
}
If you use a lookuptable (e.g. projectNameToId) you can use that to translate the name of the team to the id.
Id's of the team can be found if you go to the team menu and take the number in the URL after team. E,g, https://xxx.atlassian.net/jira/people/team/1d4ff324-f3e4-4f01-aff5-ce5613cdfe43
Where 1d4ff324-f3e4-4f01-aff5-ce5613cdfe43 is the team id.
{
"fields": {
"Team": {
"id": "{{projectNameToId.get(userInputs.team)}}"
}
}
}
Good luck
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think I got closer with this one - however I still run into the following issue:
For simplicity's sake I reduced the case to two teams and use the following code (whether I use "Team" or "customfield_10001" seems to not matter)):
{
"fields": {
"customfield_10001": {
"id": "{{if(equals(userInputs.team, "Team 1"), "55063845-50cd-46fa-ba80-7857298897be", "030e8d46-e3b3-4249-a499-1130ff0963a0")}}"
}
}
}
If I select "Team 1" in the dropdown the equals returns true and the if therefore returns the first team id. However, even though I have issues in the selected project assigned to the team with that id, I get the error
The team id "JsonData{data={id=55063845-50cd-46fa-ba80-7857298897be}}" is invalid. (customfield_10001)
Any idea why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem seems to lie deeper - even if I try to set the id directly:
{
"fields": {
"customfield_10001": {
"id": "55063845-50cd-46fa-ba80-7857298897be"
}
}
}
I get the same error. I also tried to reference the field by name ("Team") or set the "value" instead of "id". I always get the same error. I verified the team id 3 times by now, the team id is definitely correct and if I set the team manually on an existing issue in that project I see a PUT request for that issue containing said id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Fabien This is a reply on your first comment above:
{
"fields": {
"customfield_10001": {
"id": "{{if(equals(userInputs.team, "Team 1"), "55063845-50cd-46fa-ba80-7857298897be", "030e8d46-e3b3-4249-a499-1130ff0963a0")}}"
}
}
}
This is invalid, because you have used the double quotes two times. I think it should be:
{
"fields": {
"customfield_10001": {
"id": {{if(equals(userInputs.team, "Team 1"), "55063845-50cd-46fa-ba80-7857298897be", "030e8d46-e3b3-4249-a499-1130ff0963a0")}}
}
}
}
(Strip the doubles in front of the {{if and after }} )
But your next comment showed me that the JSON I proposed does not work. So I tried myself and saw that it indeed not worked (I got the same cryptic error message). Fortunately this does work for me:
{
"fields": {
"Team": "305e83e6-a643-45f6-8279-b74eb8f2cff9"
}
}
Which for you means, that this should work:
{
"fields": {
"customfield_10001": {{if(equals(userInputs.team, "Team 1"), "55063845-50cd-46fa-ba80-7857298897be", "030e8d46-e3b3-4249-a499-1130ff0963a0")}}
}
}
Regards,
Rudy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Fabien
I recall the advanced roadmap fields are not fully supported by automation rules, and the custom field id value may be used, rather than the field name, in an advanced edit with JSON.
Please use this how-to article to determine your Team field's custom field id: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
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.
This doesn't seem to be the problem. It correctly identifies the field as "customfield_10001" and it makes no difference whether I reference it as "Team" or "customfield_10001".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information. A couple of more things to try:
First, is that Team field single or multiple select for the issue? The JSON syntax is different if this is multiple select: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Multi-select-custom-field
Next, have you tried to simplify the conditional part (of using the team id) with a Lookup Table?
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.