It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Regarding Saving a Custom Field in JIRA DB Edited

Hello All,

 

My objective is to set value to a particular custom field (select type) and store in JIRA db. This is my entire code. Can anyone let me know what am I missing ?

 

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.fields.CustomField;
import org.apache.log4j.Logger;
import static org.apache.log4j.Level.DEBUG;
import com.onresolve.scriptrunner.runner.util.UserMessageUtil;
import com.atlassian.jira.event.type.EventDispatchOption;


CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
CustomField customField = customFieldManager.getCustomFieldObjectByName("% Completion");
IssueManager issueManager = ComponentAccessor.getIssueManager();
if(issue.issueType.name == "Conversion Execution")
{
issue.setCustomFieldValue(customField, "25%");
UserMessageUtil.success("Code is compiling till here with no error logs.");
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Localize Smarter with the Transifex Integration for Bitbucket

Over 52% of internet users say obtaining information in their own language is more important than price and 75% of the world’s population doesn’t speak English. It’s no wonder then that successful gl...

253 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you