Our Perforce integration writes to the Jira comments when code is submitted for a bug fix.
We would like to replace text (make hyperlinks) within the last comment posted from Perforce.
Can this be done using Automation for Jira?
Hi Jonathan,
We don't support editing comments just yet. It's a good suggestion though and I've raised https://codebarrel.atlassian.net/browse/AUT-419 now to track this!
We've got quite a few higher priority items in our backlog at the moment so it will be a while before we can get to this, but we'll let you know when we get a chance to work on this.
Cheers,
Andreas
Hi Andreas,
Thanks for the quick response.
As i cannot modify the comment, is it possible to read the last comment, take the info i need and create an 'Issue Links - Link to (web link)'?
I see the example for Linking Issues but the 'links to' needs to be type 'Web link'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
Sorry, but we don't support creating remote issue linkes yet either (https://codebarrel.atlassian.net/browse/AUT-176). They use a different REST API compared to standard issue linkes when creating them.
Cheers,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks.
My last idea then is to simply write the link to a multi-line text field.
Unfortunately, I'm currently struggling append to any values currently in the field:
Is this possible?
{
"update": {
"Commit ID": [{
"add": "{{issue.comments.last.body.replaceAll(\"Change: ([0-9]*), User: ([a-z]*),\", \"http://myURL/changes/$1\")}}"
}]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jonathan,
So you you can't use the 'add' operation like this with text fields to add a value. 'add' is meant for multi-value fields like labels or multi-selects.
I think what you want is to set it to the old value plus the new value. This should work:
{
"update": { "Commit ID": [{ "set": "{{issue.fields.Commit ID}} {{issue.comments.last.body.replaceAll(\"Change: ([0-9]*), User: ([a-z]*),\", \"http://myURL/changes/$1\")}}" }] } }
So you're basically setting it to the current field value + the new links.
Hope this helps!
Cheers,
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andreas,
Thank you! this is exactly what i needed :)
The final solution:
Our Perforce integration writes to the Jira Comments field:
Change: 142491, User: jowalton, Date: 2016/12/14 15:27:42 Description: Change filetype
Automation: When: Issue Commented If: Initiator is P4 integration account Then: Edit issue fields (Advanced).
{ "update": { "Commit ID": [{ "set": "{{issue.fields.Commit ID}}{{issue.comments.last.body.split(\",\").first.replaceAll(\"Change: ([0-9]*)\", \" http://myURL/changes/$1\").concat(\"\\n\").trim()}}" }] } }
Commit ID displays (multi-line text field):
http://myURL/changes/142491
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.