The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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 Champions.
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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Fabian Lim
Community Champion
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 Champions.
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 :-(

TAGS
AUG Leaders

Atlassian Community Events