How to use ComponentAccessor () in Script Runner in Jira Cloud.
I'm trying to get customfield value through this method
Hi Mayur,
Cloud and DC are very different pieces of software, and although Scriptrunner for Jira only has one name, it is also two very different things.
DC code will generally not work on Cloud, the language and structures are very different.
You don't need to use componentAccessor on Cloud (you generally don't need it on DC any more, if you've got a version of Scriptrunner that enables HAPI).
Have a look at https://library.adaptavist.com/entity/update-cf-values-all-issues-cloud?tab=cloud - it shows you how to read and write custom fields with Cloud scripts
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_10301")
// You can also use by name
//Def cField = customFieldManager.getCustomFieldObjectsByName("customfieldname")[0]
def cFieldValue = issue.getCustomFieldValue(cField)
Hope this will be helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is not, the question is for Cloud, not DC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ohhh Thanks @Nic Brough -Adaptavist-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.