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) }
}
}}}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.