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

0 votes
Jack Nolddor _Sweet Bananas_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events