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:
Using Jira expression syntax, I'm receiving a 400 error when executing the post-function. Here is the expression I attempted:
(issue.<span>fields</span>.<span>customfield_10605</span>.<span>requestType</span>.<span>name</span> == <span>'Office Service Request'</span> || issue.<span>fields</span>.<span>customfield_10605</span>.<span>requestType</span>.<span>name</span> == <span>'Report Office Incident'</span>) ? <span>'Mercury'</span> : (issue.<span>fields</span>.<span>customfield_10605</span>.<span>requestType</span>.<span>name</span> == <span>'Report an Incident for an Application or System'</span> || issue.<span>fields</span>.<span>customfield_10605</span>.<span>requestType</span>.<span>name</span> == <span>'Service Request for an Application or System'</span>) ? (issue.<span>fields</span>.<span>customfield_18708</span> && issue.<span>fields</span>.<span>customfield_18708</span>.<span>value</span> == <span>'Moon'</span> ? <span>'Lunar'</span> : issue.<span>fields</span>.<span>customfield_18708</span> && issue.<span>fields</span>.<span>customfield_18708</span>.<span>value</span> == <span>'Mars'</span> ? <span>'Martian'</span> : issue.<span>fields</span>.<span>customfield_18708</span> && issue.<span>fields</span>.<span>customfield_18708</span>.<span>value</span> == <span>'Saturn'</span> ? <span>'Saturnian'</span> : <span>'Mercury'</span>) : <span>DefaultProject</span>;
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
Hi @Fredson N_
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
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,
It looks like you're new here. Sign in or register to get started.