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.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
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%}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.