I have some custom fields I would like to print in a custom email generated as a Script Runner post function. BUT I only want the fields printed if value != null.
I am trying to use this template:
<%
if (cfValues['Other Reason'] == 'Other') {
out << "value is ${cfValues['Other Reason']}"
}
else {
out << "test"
}
%>
This is my actual code:
<%
if (issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Client Case Number")) != null) {
out << "Client Case Number: ${issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Client Case Number"))}"
}
else {
out << "Client Case Number: "
}
%>
Right now this works when plugged into the builtin Script Runner Preview page, but not when plugged into my workflow.
Thank you,
Ben