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

H Ashiqur Rahaman (SDC - Kolkata) I'm New Here Mar 03, 2019

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar invitation: Generate custom Jira Cloud PDF reports and exports

Jira may be a staple part of your workday, but your colleagues, customers, business partners or an auditor might need information presented in a different format, that is easy to access and read. And...

56 views 0 1
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