Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Asset Postfuction conditions

Martin Svensson
Contributor
June 17, 2024

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.

Screenshot_20240617_221216_Chrome.jpg

1 answer

0 votes
Christian Schürer-Waldheim
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 3, 2024

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;

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events