Hello Team,
We have a requirement to copy fields when a link is created which includes System and Custom field fields. We have "Automation for Jira", however it uses common user which doesn't track the who has done the changes.
Environment: Jira Cloud
Add-On: Script Runner for Jira Cloud
Can anyone help me with the sample script, that would be helpful and appreciated. I am beginner, I tried on my own referring existing sample scripts with no success.
Requirements:
When related record type is Duplicates and Initiating Dept = PSO CII and SFDC ID is not null then copy changes to current record to all children of type = Duplicates.
Conditions:
Initiating Dept: Single select custom field
SFDC ID: Single line text field
Issue Type: CII
Fields to be copied: Status, Priority, Assignee, Desc etc
I referred few scripts, They say specify issuekey: Does this mean happen only for specified key?
{code:title=Bar.java|borderStyle=solid}if (issueLink.issueLinkType.name == "Duplicate"){
def sourceIssueResponse = get("/rest/api/2/issue/${issueLink.sourceIssueId}").asObject(Map)
assert sourceIssueResponse.status == 200
def sourceIssueKey = sourceIssueResponse.body.key
def destinationIssueResponse = get("/rest/api/2/issue/${issueLink.destinationIssueId}").asObject(Map)
assert destinationIssueResponse.status == 200
def destinationIssueKey = destinationIssueResponse.body.key
def parentissue = get('/rest/api/2/issue/' + sourceIssueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
.body
def parentPriority = parentissue.fields.priority.name
def updateissue = put('/rest/api/2/issue/' + destinationIssueKey)
.header('Content-Type', 'application/json')
.body([
fields:[
priority : parentPriority
]
])
.asString()
}
{code}All looks fine, update isn't working fine, please help me