In the post functions Script runner clone issues:
To Update Cloned issue Summary, the default script given is
issueInput.fields.summary = "${issueInput.fields.summary} was Cloned by my Script"
However i want to add parent key and value of field 'Country' from parent issue into the cloned issue summary.
i.e. I want country name from parent issue and parent key in Cloned issue summary.
For example: "India Issue-12 This is TEST issue".
I am running following commands but it is not working. :-(
1st command
issueInput.fields.summary = "${issueInput.fields.country} ${issueInput.parent.key} This is TEST issue"
2nd command
issueInput.fields.summary = "{{issue.fields.country}} {{parent.key}} This is TEST issue"
3rd command
issueInput.fields.summary = "{{Country}} {{parent.key}} This is TEST issue"
Please help.
Hi,
This should work for you case:
def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Country'}
def countryValue = sourceIssue.getCustomFieldValue(cf).toString()
issue.summary = countryValue + ' ' + sourceIssue.key + ' Communication Initiated'
Thanks,
CustomFieldManager class is to be defined before the script you provided, I believe I need to find the replacement for the below import statements - as it is not accepted in the script. Any thoughts what should I use instead of following to import the class and define customFieldManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Country'}
def countryValue = sourceIssue.getCustomFieldValue(cf).toString()
issue.summary = countryValue + ' ' + sourceIssue.key + ' This is TEST issue'
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've just checked. I just input these three rows and everything works fine:
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.