Hello,
I am trying to set up a post function that sets a JIRA custom field with the attribute value from a selected object, but only if that custom field is already empty. If it it empty, the post function should be skipped. I currently have this entered in the Condition box:
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_xxxxx")
issue.getCustomFieldValue(cf) = null
I have had some success with this condition in the past if I use "!= null" but can't ever get the condition to recognise an empty custom field or a specific value.
Does anyone know where I've gone wrong?
Hi,
The import statement is wrong with the ComponentAccessor. This is how it should look:
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;
CustomField cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_xxxx");
if (issue.getCustomFieldValue(cf) == null) {
// Do something
}
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.