I'm trying to change the fragment of text "John" from last comment, if founded to be {status:colour=Red|title=John|subtle=true} like below - POSSIBLE?
To expand the answer on more technical way, you can do this by manually creating a POST request with https://<your-domain>.atlassian.net/rest/api/3/issue/<issueIdOrKey>/comment
You can do this in Postman, Swagger or any software that is used for API testing. For authorization use your email and the Atlassian API.
For header you would need:
Key: Content-Type
Value: application/json
As for the body, you would need this JSON structure:
{
"body": {
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "text text text text text "
},
{
"type": "status",
"attrs": {
"text": "John",
"color": "red"
}
},
{
"type": "text",
"text": " text text text text text"
}
]
}
]
}
}
Available Status Lozenge Colors:
"red" (Red / Danger)
"green" (Green / Success)
"yellow" (Yellow / Warning)
"blue" (Blue / In Progress)
"purple" (Purple / Custom)
"neutral" (Grey / Default)
Hi @TestingExternalAccessOnly
Welcome to the Atlassian Community!
Yes, you can identify and replace John from the latest comment using Automation smart values, but there is an important limitation regarding the Status lozenge.
Jira Cloud comments are stored and rendered using Atlassian Document Format (ADF). Therefore, replacing the text with something like: {status:colour=Red|title=John|subtle=true} won't turn John into a rendered Status lozenge.
That syntax is Jira wiki markup and isn't interpreted as an ADF Status element when inserted into a comment through a smart-value text replacement. For example, Automation can perform a normal replacement using something similar to {{issue.comments.last.body.replace("John","...")}} but the replacement value is still content within the comment , Automation doesn't convert legacy wiki markup into the corresponding ADF node.
If you specifically need the red Status lozenge shown in your screenshot, the reliable approach is to construct the comment as ADF and update/create it through Jira's REST API, for example using Automation's Send web request action.
The ADF document would contain the normal text nodes and a status node for John.
One other consideration: if you intend to modify the existing last comment rather than add a new comment, you'll need its comment ID and use the REST API's Update comment operation. Also make sure the Automation actor has permission to edit that comment.
So, in short, replacing plain text is possible directly with Automation, but replacing it with a rendered Status lozenge requires working with ADF rather than {status:...} wiki markup.
Regards,
Gor
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.