Hi,
We are working on an automation which clone certain issues, as a part of it we want to clone only text comments (not images or attachments).
Can someone help with regex expressions or any any thing, which checks the comments and copies to new field in cloned ticket.
I tried this
{{#issue.comments}}
*Comment by* : {{author.displayName}} at: {{created}}
{{body}}
{{/}}
but even images are also copying, but not in a readable format (refer below image)
Thanks,
Raju
Would you please post an image of your complete rule for context? That may help the community to offer ideas. Thanks!
Until then, I am guessing that you are:
To do what you ask, I recommend writing to the audit log (or using the REST API) to look at example comments' contents that you want to clean up. That will show what you need to remove/replace when copying the comments.
Kind regards,
Bill
Let me add some context on this, this rule is manually triggered by users, who ever wants to clone the issues.
This Automation will clones Epic & its stories also (along with attachments), Now i would like to copy comments also, when ever i am trying to copy comments it is copying attachments also which is in unreadable format (showing a error as failed to load)
Rule Pics.
Rule-1 --> which clones Epics
Rule -2 --> which clone child user stories.
Code i used for Attachments :
{{issue.description.replaceAll("!","_")}}
*Attachments links from Original Ticket*
{{#issue.attachment}}
- [ {{filename}} | {{content}} ] - {{size}} Bytes - {{author.displayName}} - {{created.jiraDate}}
{{/issue.attachment}}
Image for attachments.
In similar way i would like to copy all comments from original ticket for which i used below code.
{{#issue.comments}}
*Comment by* : {{author.displayName}} at: {{created}}
{{body}}
{{/}}
But it is copying images also, which i didn't want.
Hope this context is useful.
Thanks,
Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information.
Have you confirmed that your "copy" of attachments is duplicating them or is it just pointing to the links from the source issue?
For comments handling as you have asked, again I suggest:
To do what you ask, I recommend writing to the audit log (or using the REST API) to look at example comments' contents that you want to clean up. That will show what you need to remove/replace when copying the comments.
You would use the text functions, such as remove() or replaceAll() to eliminate any embedded images/attachments from comment text.
Please note that your adding of attachments earlier *will* still include those as links; they just would not be with the comment text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there any smart value which gives us what type of comment is added (either text type/image type).
Thanks,
Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As comments could contain a variety of content (plain text and otherwise) there is no single type for a comment. You would need to check the body for any markup/tags indicating things like images or attachments.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found that all the comments which contains images starts with ! and ends with !, which i got it from audit log info
Eg:
!pic-3.PNG|width=1007,height=489!
now can you help me with any regex expressions which doesn't pic these, i tried like
{{#if(issue.comments.body.startsWith("hello"))}}
*Comment by* : {{author.displayName}} at: {{created}}
{{body}}
{{/}}
just to copy only hello comment from set of comments. need your assistance in this issue.
Thanks,
Raju
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps try replaceAll() as I suggested using a simple expression which looks for the common elements between the exclamation points:
{{issue.comment.body.replaceAll("(!.*width=.*height=.*!)", "")}}
You may need to experiment with this as I am not familiar with all possible formats of images in the markup.
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.