How do I copy name of issuetype in custom field?
Hi, it should be something like
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.fields.CustomField
import groovy.transform.Field
// ID of the field
final String customFieldId = "10101"
// the name of a 'text field' custom field
final String issueTypeName = issue.issueType.name
def issueService = ComponentAccessor.issueService
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issueKey)
def issueInputParameters = issueService.newIssueInputParameters().with {
// set text fields
addCustomFieldValue(customFieldId, issueTypeName)
}
def updateValidationResult = issueService.validateUpdate(loggedInUser, issue.id, issueInputParameters)
assert updateValidationResult.valid: updateValidationResult.errorCollection
def issueUpdateResult = issueService.update(loggedInUser, updateValidationResult, EventDispatchOption.ISSUE_UPDATED, false)
assert issueUpdateResult.valid: issueUpdateResult.errorCollection
I used this snippet: https://library.adaptavist.com/entity/update-the-value-of-custom-fields-through-the-script-console
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, you need to describe your usecase...you are on server...so you have scriptrunner installed? Do you have automation for jira App?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have an installed version of the server, as well as installed automation, but no scriptrunner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok you can use smartvalue {{issue.issueType.name}}. I just tested it and it works for Issue Created Trigger and Edit issue action. I tested it on Cloud so I hope it will be OK for Server/DC version:
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.