Forums

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

Set up field values as taget project summary

Lakshmi CH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2020

Hi Team,

 How to set the field values in target project summary. I am using script post function (Cloning an issue, and links). Here i am planning to create a ticket from source project to target , but I want to add the source  field as summary of the target project. I tried with this script, but the ticket is not creating in target project, when I removed the I was able to create the ticket. Did I miss anything in the below script ? and please find the attached screenshot for your reference.scripcopy.PNG

 

import com.atlassian.jira.component.ComponentAccessor

def optionsManager = ComponentManager.getComponentInstanceOfType(OptionsManager.class)
def customFieldManager = com.atlassian.jira.component.ComponentAccessssor.getCustomFieldManager()

def customfield1 = customFieldManager.getCustomFieldObjectByName("Hub Name")
def customfield2 = customFieldManager.getCustomFieldObjectByName("TPD Document Type")

def hubname = issue.getCustomFieldValue(customfield1)
def tpddoctype = issue.getCustomFieldValue(customFfeld2)

//Add Hub name and TPD Document Type to target project ticket summary.
issue.summary = + hubname + " / " + tpddoctype

 

1 answer

1 accepted

1 vote
Answer accepted
Hana Kučerová
Community Champion
August 5, 2020

Hello,

I've found two typos in your script:

  • ComponentAccessssor-> ComponentAccessor
  • customFfeld2 -> customfield2

I've changed your script a little bit, please try:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

CustomField customfield1 = customFieldManager.getCustomFieldObjectByName("Hub Name")
CustomField customfield2 = customFieldManager.getCustomFieldObjectByName("TPD Document Type")

def hubname = issue.getCustomFieldValue(customfield1)
def tpddoctype = issue.getCustomFieldValue(customfield2)

//Add Hub name and TPD Document Type to target project ticket summary.
issue.summary = hubname + " / " + tpddoctype
Lakshmi CH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 6, 2020

Thank you @Hana Kučerová  for your quick help. It's working as expected.

Suggest an answer

Log in or Sign up to answer