Missed Team ’24? Catch up on announcements here.

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

Insight Post Function - Set a JIRA Custom Field - With Condition

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2021

Attempting to populate the Request Participants custom field, which works ok.

But only need this to happen if the 'Request Participants' field is empty.

But I cannot seem to get the Groovy condition code working.

Current groovy code I have is:

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;

def value = issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10108));

if ( value = null) {
return false;
} else {
return true;
}

Even tried the following

(! cfValues['Request participants'])

 

But when either code is present in the condition box, it fails to populate despite the filed being empty.

Without the code in it works, but runs the risk of replacing what was previously set. 

 

 

1 answer

1 vote
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2021

@David Harkins:

You forgot to the double "==" in the if statement.

if ( value ==null)
David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2021

HAHA yeah I got that one, but still not working.

If Request Participants is not populated the it still doesn't equate to NOT NULL :-(

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events