Update custom fields using using Atlassian SDK (.Net)

I added custom field on Jira server and I want to update that field using Atlassian SDK (.Net), I can not able to do this with right approach.

Could you please help me?

2 answers


You can look into JIRA APIs
The main one you can look into is ComponentAccessor. From here you can explore more methods that better suit your needs.

For example if you want to find something related to issue and customfields, then you can look into their APIs and methods. 

From ComponentAccessor you can navigate IssueManager Api and CustomFieldManager and explore them for your particular usage.

There are certain plugins as well like ScriptRunner that can help you add back-end code to a field and update it. 

For example you can access your custom field from a certain issue like this:

import com.atlassian.jira.component.ComponentAccessor

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def issueObject = issueManager.getIssueObject("Issue-Key")

// Get your Custom Field by its ID
def customFieldObject = customFieldManager.getCustomFieldObject(customFieldID)

// Get All custom fields within a issue scope
def customFieldObjects = customFieldManager.getCustomFieldObjects(issueObject)

// See if your customfield is in the issue
// If it is, then do what you want with it.
if (customFieldObjects.contains(customFieldObject))
// Do your stuff with the field


Thank you for reply.

Actually I'm using Atlassian.SDK which supports for .Net Library.

I am able to fetch custom fields but stuck to update that field through code.

For example :

var temp = await JiraInstance.Fields.GetCustomFieldsAsync();


using this I can retrieve all custom fields for that project but how can i updated particular fields?

Could you please help me?

To update the customField you can use the updateValue method.

It takes in Fieldlayout, IssueObject, Modified Value (need to pass both old and new value) and IssueChagneHolder. 

You can try something as follows:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

// Get issueObject by key.
def issueObject = issueManager.getIssueObject("Issue-KEY")

// Get the CustomField by its ID
def customFieldObject = customFieldManager.getCustomFieldObject(10125)

// Get the current value of CustomField
oldValue = customFieldObject.getValue(issueObject)

// Create a new value to assign later on
String newValue = "New Value"

//Main method to update custom field.
changeHolder = new DefaultIssueChangeHolder()
customFieldObject.updateValue(null, issueObject, new ModifiedValue( oldValue, newValue), changeHolder)

As an example I was explicitly getting issue object based on key, you can change that to generalize it for all issue. 

0 votes

You are going to need to explain what context your code is running in.

Is it an add-on for Server, and add-on for Cloud, an external program, or are you hacking the core of Jira?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,279 views 5 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you