Forums

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

Condition is not working in post function workflow

Manoj
Contributor
May 29, 2023

Dear Community.

Need your help/guidance pls.

 I am using custom email post function with a condition configuration as below.

 

issue.issueType.name == 'Bug'||issue.issueType.name == 'Demand'&& issue.priority?.name == '1-Blocker'||issue.priority?.name == '2-Critical'
Unfortunately it is working partially, my requirement is when user select Issue type BUG OR DEMAND and Priority either 1-Blocker or 2-critical then it trigger an email to specified user.
Thanks

1 answer

1 accepted

0 votes
Answer accepted
Vikrant Yadav
Community Champion
May 29, 2023

Hi @Manoj Try to apply this condition :- 

 

(issue.issueType.name == 'Bug' || issue.issueType.name == 'Story') && (issue.priority?.name == 'Major'|| issue.priority?.name == 'Minor')
Manoj
Contributor
May 30, 2023

@Vikrant Yadav Thanks for replying back, i replaced my written script with your shared one (replacing priorities) but at the bottom when i checked preview i got to see 

Condition evaluated to false (note that for listeners the condition can't normally be tested) does that means my script is not true and email trigger will not happen?

This is mine 

 (issue.issueType.name == 'Bug' || issue.issueType.name == 'Demand') && (issue.priority?.name == '1-Blocker'|| issue.priority?.name == '2-Critical')

pls suggest.

Vikrant Yadav
Community Champion
May 30, 2023

Hi @Manoj  Are you using Script runner "Send Custom email post function" or you are using some other custom email post function plugin ? 

You can test the script by performing action on the issue. In Post function, you can't test script condition, you can only check preview of email.

Manoj
Contributor
May 30, 2023

@Vikrant Yadav Hi, 

I am suing Script runner "Send Custom email post function"  and yes i can see the preview but while performing action, i mean when i create a ticket with set condition it does not trigger any email.

Vikrant Yadav
Community Champion
May 30, 2023

@Manoj  if you are applying this post function on create transition, then move it below "Creates the issue originally" post function.

All conditions ( issue and priority) meet when creating an issue ? 

Manoj
Contributor
May 30, 2023

@Vikrant Yadav i have moved it below to "Creates the issue originally" post function. it works with Demand (issue type) and priorities but does not work with BUG (issue type)

Vikrant Yadav
Community Champion
May 30, 2023

@Manoj it's weird. Working fine on my side.

Try to add another post function, use only. 

(issue.issueType.name == 'Bug') && (issue.priority?.name == 'Major'|| issue.priority?.name == 'Minor')
Manoj
Contributor
May 30, 2023

@Vikrant Yadav let me try this out, but question mark do here? after priority?.name and why its after issuetype? just for my knowledge

Manoj
Contributor
May 30, 2023

@Vikrant Yadav Thanks for your responses on my queries and support, i realized Bug and demand issue types has different workflows hence it was not working in a combined query, now its working applying separately.

Like Vikrant Yadav likes this
Vikrant Yadav
Community Champion
May 30, 2023

Glad to hear it works for you :)

If Both issue type are using separate workflow, then you have to apply condition in both workflows. 

Suggest an answer

Log in or Sign up to answer