I am working on collecting Fields/Values on issue creation and while I can get the fields/values the problem is I'm getting fields that are not even for this issue type and are not even available to the user to use when creating.
Is there some way to get the Field/Values that are ONLY part of the Issue that the event was triggered for?
Another issue I'm having is that despite checking for null or empty I still get items that are empty. <solved most of these>
Here is the test code I've got working based on other examples found online:
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;
def cfm = ComponentAccessor.getCustomFieldManager();
def fieldsUsed = cfm.getCustomFieldObjects(event.issue);
fieldsUsed.each
{
def fval = event.issue.getCustomFieldValue(it).toString().trim();
if (event.issue.getCustomFieldValue(it) != null && !fval.isEmpty())
{
log.warn("Field: ${it} - Value: ${event.issue.getCustomFieldValue(it)}");
}
}