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: 

How Can I set value of custom field from plugin

Aayush Mohanka
February 12, 2021

I have tried below code, it gives me exception.

Issue issue = issueEvent.getIssue();
CustomField customField = customFieldManager.getCustomFieldObject("customfield_12200");
ModifiedValue mVal = new ModifiedValue(issue.getCustomFieldValue(customField), issueEvent.getIssue().getAssignee());
customField.updateValue(null, issue, mVal, new DefaultIssueChangeHolder());

 

It throws exception in 

public void createValue(CustomField field, Issue issue, @Nonnull T value) {
this.customFieldValuePersister.createValues(field, issue.getId(), this.getDatabaseType(), Lists.newArrayList(new Object[]{this.getDbValueFromObject(value)}));
}

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Jack Nolddor [Sweet Bananas]
Atlassian Partner
February 13, 2021

Hi Aayush Mohanka and welcome,

Do you mind to share with us the whole stacktrace of the error to see if anyone here can help you with your problem?

Usually, errors when setting up a new value within a field are caused by permission issues (i,e. the field isnt editable at all or the user who is performing the action hasn't the necessary permission for do that) or either you are setting up an incorrect value type on that fields (i,e, the field expects an ApplicationUser.class but you are updating the field with just the username property which is an String.class or things like that)

Best Regards

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events