Forums

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

JMWE Conditional expression

Anette Noll
Contributor
November 23, 2022

Hi all.

need help for the following scenario:

Within a workflow I have a custom field with various checkboxes. If I click checkbox A and B two other workflows are generated and linked to the parent issue.

Problem is, das A and B are generated again with each transition.

It is no solution to use function delete value.

I wonder how is the expression for:

If field x contains A than workflow must not be generated (again).

 

2 answers

2 accepted

0 votes
Answer accepted
Anette Noll
Contributor
November 23, 2022

Hi David,

Yes, you are right. 

This is the shared action which is used. I guess that the last term (run shared action conditionally) must be complemented like:

only run this if 'job content list' is not null and job was not choosen before

 

Share_Action_Create_Subsystem.PNG

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

Hi @Anette Noll 

by "two other workflows are generated", I assume you mean that you are creating two other Jira issues, correct? Are you using the Create Issue(s) post-function for that? Can you share you current configuration?

Anette Noll
Contributor
November 23, 2022

Hi David,

Yes, you are right. 

This is the shared action which is used. I guess that the last term (run shared action conditionally) must be complemented like:

only run this if 'job content list' is not null and job was not choosen before

 

Share_Action_Create_Subsystem.PNG

David Fischer
Community Champion
November 24, 2022

Hi @Anette Noll ,

question: imagine your checkbox field has 3 values: A, B, and C. The first time you run this post-function, A and B are selected so you create two new issues. Later, you run the post-function again but this time A, B and C are selected. Do you then want to create a new issue for C, or just do nothing because an issue was already created earlier for A and for B?

Anette Noll
Contributor
November 24, 2022

Hi @David Fischer  ,

that is exactly the case:

"The first time you run this post-function, A and B are selected so you create two new issues. Later, you run the post-function again but this time A, B and C are selected. Do you then want to create a new issue for C"

David Fischer
Community Champion
November 25, 2022

In that case, you can't use conditional execution, which runs only once for the Create Issue(s) post-function and not once per issue to create. Instead, you need to modify the Iterator so that it only returns values for which an issue wasn't created before.

You can try something like this (I'm not able to fully test it though):

{% set values = issue.fields.customfield_10200 %}
{% for linkedIssue in issue | linkedIssues("relates to", ["customfield_10200"]) %}
{%set values = values | filter(["value",linkedIssue.fields.customfield_10201],true) %}
{% endfor %}
{{values | join(",","value") }}

where  customfield_10200 is the ID of the Job Content List KATB field and customfield_10201 the ID of the Subsystem KATB field.

Anette Noll
Contributor
November 27, 2022

Hi David,

thank you for your time but problem persits in the same way:

checkbox field has value: A (customfield_10200); i.e. Roboter. The first time post-function runs, A is created. Then value B is selected (i.e. Portal) additionaly; post-function runs again, B (Portal) is created but also A (Roboter) is created repeatedly.

 

Maybe screenshot helps to describe problem more precise:

 

Jira_Create_Subsystem.PNG

David Fischer
Community Champion
November 27, 2022

Can you share a screenshot of the updated post function?

Anette Noll
Contributor
November 27, 2022

Jira_Create_Subsystem_Shared_Action.PNG

David Fischer
Community Champion
November 27, 2022

Sorry, I noticed a mistake in the iterator script I suggested. On line 2, it should be customfield_12904 (the field that is then accessed on line 3). 

Anette Noll
Contributor
November 27, 2022

It works perfect!

Thank you so much!!

Suggest an answer

Log in or Sign up to answer