Forums

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

Copy Comments from One Ticket to Another During Automation

Samantha Hiner
March 31, 2023

Hello!

I am setting up an automation to move (via cloning and deleting) a ticket from one project to another project based on specified triggers.

As part of this, I would like to copy the comments from the original ticket to the new clone. I've seen lots of articles on using smart values, but why doesn't the Set Field Value option on the Clone Action work?

I am able to copy the Description and Labels using this feature. However, the "Copy Comments from [Trigger OR Current Issue]" does not work for me. I receive an error, "

Could not find your configured field, it may have been deleted? Comments."
Again, the copying of comments on the Clone Action does not work with either "trigger" or "current" issue.
Thank you!
Sam
Automation Setup
Screenshot 2023-03-31 at 1.06.39 PM.png
Error
Screenshot 2023-03-31 at 1.10.55 PM.png

1 answer

1 accepted

0 votes
Answer accepted
JamieA
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 Champions.
March 15, 2012

It should work, try something like:

AJS.$(function () {
	AJS.$("#summary").closest("div").after("<hr>")
});

It's a bit harder in jira5, but you can still do this.

Eric Blair
Contributor
March 15, 2012

Thanks, but it doesn't work, this is what i tried:

<script language="JavaScript">

jQuery(function(){

AJS.$("customfield_10510FieldArea").closest("div").after("<hr>");

});

</script>

nothing happens when I do that. And there is a div there, I can edit the dom with chrome and insert an HR manually and that works.

JamieA
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 Champions.
March 15, 2012

> Thanks, but it doesn't work

Yeah, but what I put does work, because I tested it.

You don't mention what jira you're on, but that fieldarea stuff is an old version. If it's an element ID then you need a #, ie AJS.$("#customfield_10510FieldArea")

JamieA
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 Champions.
March 15, 2012

No, it doesn't matter. The IDs changed between one version of jira and the next around that time, I think FieldArea was downcased. Can you paste the bit from the html source that contains that element, so we can check.

NB - this is one problem with doing this, you will end up needing to change it quite often.

Eric Blair
Contributor
March 15, 2012

I'm on 4.1 Jira. I added the hash and still nothing. I do have javascript in other fields and that works. Does this code need to be in a specific field's description? I would imagine not.

Eric Blair
Contributor
March 15, 2012

This worked for me:

<script language="JavaScript">

jQuery(function(){

AJS.$('#customfield_10649FieldArea').find('div.fieldDescription').after('<hr>');

});

</script>

Charalambos Hadjichristodoulou
January 4, 2016

Please pardon my ignorance but is the above still valid in JIRA 6.3? Where exactly would i need to put the above code fragment?

Geoff Wilson
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 Champions.
March 23, 2017

the last 2012 comment adds some blank pixels below a field, but doesn't show any kind of horizontal rule on v7.1.9

JamieA
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 Champions.
March 28, 2017

Works for me - perhaps it's the styling of the hr

Joe Harmon
Contributor
May 23, 2018

Where are you putting the content?  In the description of any field?  Not working for me either.

Suggest an answer

Log in or Sign up to answer