I'm trying to add some conditions to an asset postfunction.
Is there any special way to do it?
Whenever ill add some groovy conditions it stops working.
There are some examples listed on the page liked below the input field: Groovy script examples | Jira Service Management Data Center 5.17 | Atlassian Documentation
Your groovy code should just return true or false, depending on whether the post function should run.
Example taken from the linked page:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
def value = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10000)); // Change ID to the correct one
/* If an insight custom field has an object called "Microsoft" it will fail */
if (value != null && "Microsoft".equals(value[0].getName())) {
return false;
}
return true;
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.