Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

JMWE Expression for Conditional Issue Creation

Hello

I am currently configuring a 'Create issue(s)' post-function in Jira Cloud using the JMWE add-on and am having some trouble setting up a conditional expression that determines the destination project for new ticket creation.

This is a issue escalation process from JSM to Jira software.

I want the destination project for creating a new ticket to be determined by the value of a "Request Type" field and a cascading "Asset" custom field. The conditions are as follows:

  1. If the request type is "Office Service Request" or "Report Office Incident", the new ticket should be created in the project corresponding to the planet "Mercury".
  2. If the request type is "Report an Incident for an Application or System" or "Service Request for an Application or System", the destination project should be determined by the value of the "Asset" field:
    • If Asset = "Moon", then the destination is the planet "Lunar".
    • If Asset = "Mars", then the destination is the planet "Martian".
    • If Asset = "Saturn", then the destination is the planet "Saturnian".
    • For any other value of "Asset", the destination project should be "Mercury".

Using Jira expression syntax, I'm receiving a 400 error when executing the post-function. Here is the expression I attempted:

 

(issue.fields.customfield_10605.requestType.name == 'Office Service Request' || issue.fields.customfield_10605.requestType.name == 'Report Office Incident') ? 'Mercury' : (issue.fields.customfield_10605.requestType.name == 'Report an Incident for an Application or System' || issue.fields.customfield_10605.requestType.name == 'Service Request for an Application or System') ? (issue.fields.customfield_18708 && issue.fields.customfield_18708.value == 'Moon' ? 'Lunar' : issue.fields.customfield_18708 && issue.fields.customfield_18708.value == 'Mars' ? 'Martian' : issue.fields.customfield_18708 && issue.fields.customfield_18708.value == 'Saturn' ? 'Saturnian' : 'Mercury') : DefaultProject;

Could you help me understand where I might be going wrong in constructing this expression? Is it an issue with the Jira expression syntax or an issue with how JMWE processes the expression?

Thanks

Fredson

1 answer

1 vote
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 07, 2023

Hi @Fredson Nogueira da Silva 

the expression for the Calculated destination Project is a Nunjucks template, not a Jira Expression. You can therefore try this:

{% if issue.fields.customfield_10605.requestType.name == 'Office Service Request' or issue.fields.customfield_10605.requestType.name == 'Report Office Incident' %}
Mercury
{% elif issue.fields.customfield_10605.requestType.name == 'Report an Incident for an Application or System' or issue.fields.customfield_10605.requestType.name == 'Service Request for an Application or System' %}
{% if issue.fields.customfield_18708.value == 'Moon'%}
Lunar
{%elif issue.fields.customfield_18708.value == 'Mars'%}
Martian
{%elif issue.fields.customfield_18708.value == 'Saturn'%}
Saturnian
{%else%}
Mercury
{%endif%}
{%else%}
DefaultProject
{%endif%}

Hi @David Fischer _Appfire_ 

Just wanted to drop a quick note to let you know that the code worked perfectly! I really appreciate your help in resolving this issue. Thanks a ton for your support!

Regards,

Fredson

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events