Console and code examples

 

Enter the Console

 

 


Console display

无标题-20241009-085907.png

 

 


Code examples

① Get currentUser

import com.atlassian.jira.component.ComponentAccessor /** * get currentUser */ ComponentAccessor.jiraAuthenticationContext.loggedInUser

② Get issue information

import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue /** * Get issue information */ def issue = ComponentAccessor.issueManager.getIssueObject("WOR-1") as Issue issue?.summary

③ Gets the value of the custom field of the issue

import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.fields.CustomField /** * Gets the value of the specified custom field of the issue */ def customField = ComponentAccessor.customFieldManager.getCustomFieldObject("customfield_10200") as CustomField def issue = ComponentAccessor.issueManager.getIssueObject("WOR-1") as Issue; issue?.getCustomFieldValue(customField);

④ create issue