Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to enter in script to copy from parent ticket? Line 7 &10?

Bailey Gallagher July 24, 2023

I have this script and I need to update line 7 & 10 to pull from the parent ticket. How would I know what to in these lines when the automation creates a new issue so each parent ticket has a unique number? Would I just make it something along the lines of parent ticket?

 

{{import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.bc.issue.properties.IssuePropertyService
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.entity.property.EntityPropertyService

Issue issueOrigin = ComponentAccessor.getIssueManager().getIssueObject("ISSUE-1")

//// When using this script in the script console uncomment the next line:
Issue issueDestination = ComponentAccessor.getIssueManager().getIssueObject("ISSUE-2")
//// When using this script in a transition uncomment the next line:
//Issue issueDestination = issue

ApplicationUser loggedInUser = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
IssuePropertyService issuePropertyService = ComponentAccessor.getComponentOfType(IssuePropertyService.class)

def allProperties = issuePropertyService.getProperties(loggedInUser, issueOrigin.id)
for(def property : allProperties){
if(property.key.contains("proforma.forms")){
EntityPropertyService.SetPropertyValidationResult result =
issuePropertyService.validateSetProperty(
loggedInUser,
issueDestination.id,
new EntityPropertyService.PropertyInput(property.value, property.key))
if(result.isValid())

{ issuePropertyService.setProperty(loggedInUser, result) }

}
}}}

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events