Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the team field via workflow

Marcelo Valença November 21, 2022

I configured JSM to, whenever a problem ticket is created in it, a related issue is created in Jira. Depending on some data inserted in the ticket, a team should be set into Jira issue, which is used to filter the item into the right board team.

For doing this work, I'm using JMWE "Create issue(s)" post-function, but the problem is that all my tries of doing that failed.

 

print 3.png

 

I have already tried to send:

id:5;

"id":5;

id:"5";

"id":"5";

"5";

5

externalId:db755f17-f9f6-432b-a21f-b5aa911ce59d-5;

"externalId":db755f17-f9f6-432b-a21f-b5aa911ce59d-5;

externalId:"db755f17-f9f6-432b-a21f-b5aa911ce59d-5";

"externalId":"db755f17-f9f6-432b-a21f-b5aa911ce59d-5";

"db755f17-f9f6-432b-a21f-b5aa911ce59d-5";

db755f17-f9f6-432b-a21f-b5aa911ce59d-5; (the image above)

title:Open Finance;

"title":Open Finance;

title:"Open Finance";

"title":"Open Finance"

"Open Finance"

Open Finance

But none of them worked. I always get the error: "Team with ID 'db755f17-f9f6-432b-a21f-b5aa911ce59d-5 ' could not be found" (or something very similar).

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
November 21, 2022

Hi @Marcelo Valença ,

can you please share a screenshot of the "Expected Value" help tab of the value editor for that field?

Marcelo Valença November 21, 2022

Sure! Here it is.

print 4.png

David Fischer
Community Champion
November 21, 2022

Hi @Marcelo Valença ,

as you can see, this field is an Advanced Roadmap for Jira (formerly Jira Portfolio) field. As such, it is only available if you are running Jira Software Premium. Are you?

Marcelo Valença November 21, 2022

Yes, @David Fischer, we are! ;)

David Fischer
Community Champion
November 21, 2022

Then the ID needs to be a number. To find out that number, assign the Team to an issue and test the following expression against that issue:

{{issue.fields.customfield_10001.id}}

Note that the team needs to be available for the current project. 

Marcelo Valença November 21, 2022

@David Fischer yes, this was one of my first attempts, but it didn't work:

The team ID is 5:

print 5.png

but when I try to configure it, I always get this error:

print 6.png

Do you have any idea what is possibly going on?

David Fischer
Community Champion
November 21, 2022

From the error message, it looks like there's an extra newline after 5. Can you check the value entered in the editor?

Marcelo Valença November 21, 2022

This is exactly how my code is:

print 7.png

Unfortunately there is no extra newline.

David Fischer
Community Champion
November 21, 2022

Actually, there is. Plenty. I count 29 lines :) 

That's because you do have newlines in the Nunjucks template, to make it look better. The solution is to use the "whitespace control" feature of Nunjucks, as explained in the "Blocks and tags" help tab. For example:

{% if issue.fields.customfield_10171.value == "Open Finance" -%}
5
{%- endif %}
Marcelo Valença November 21, 2022

Humm.... got it! It worked fine! Thanks a lot @David Fischer!

0 votes
Marcelo Valença November 22, 2022

@David Fischer, I continued to edit my code to consider the other teams and, when I did so, the error happened again. I only added another team ID in another line. Can you help me to understand what is going on?

print 8.png

This is the error in the log:

print 9.png

David Fischer
Community Champion
November 22, 2022

Hi @Marcelo Valença 

You need to use whitespace management in comments as well:

{#- a comment -#}
Like Marcelo Valença likes this

Suggest an answer

Log in or Sign up to answer