Solved: Display a specific Jira Comment in the ALM Structure

Jochen Berdi August 4, 2022

Hello Community,


We are trying to map the following situation in a column in the ALM Structure using a formula, but we are failing so far.

In the column, we want to display only the comment entries for a Jira task that begin with the word status message.

We can only manage to limit the display in such a way that all comments for the task are displayed in which the word status message occurs, but not the extract of the individual specific comment (multiple hits can also occur).

We need your help.

System
Jira Server Version Jira V8.22.4
ALM Structure Version 8.0.1

Formula

comments.filter(if(search("Status", comments), $.body).map(CONCAT(
$.author.user_display_name(),
" said at ",
FORMAT_DATETIME($.created, "yyyy-MM-dd HH:mm:ss"),
": ", $.body))
comments.filter(if(search("status message", comments), $.body).map(CONCAT(
$.author.user_display_name(),
" said at ",
FORMAT_DATETIME($.created, "yyyy-MM-dd HH:mm:ss"),
": ", $.body))

Result, all comments at wordt'hit are displayed.

Greetings
Jochen

1 answer

1 accepted

2 votes
Answer accepted
David Niro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 4, 2022

Hello @Jochen Berdi ,

David from ALM Works here.  

My colleague @Nicholas Ellis _ALM Works_ and I reviewed your formula and made some adjustments that we believe should help.

There are some comments in the formula for reference.

With Status_Match = 
comments.FILTER($.MATCH("/\Astatus/")) //match comments that begin with "status"
:

IF Status_Match:
Status_Match.map(
CONCAT(
$.author.user_display_name(), " said at ",
FORMAT_DATETIME($.created,"yyyy-MM-dd HH:mm:ss"),
": ", $.body, " \\\\ \\\\ " //paragraph break
) //concat end
) // map end

Under "Options" you will want to select "Wiki Markup" for the paragraph break to work properly.

The real change was related to 

FILTER($.MATCH("/\Astatus/"))

We want to use MATCH here to look for the exact text value and we use the regular expression \A to identify the beginning of the string, which in your case should be "status".

Please let me know if this helps!  I'm looking forward to your feedback!!

Best,
David

Jochen Berdi August 4, 2022

Hello David

thanks for your adjustments, it works great :-)



best regards
Jochen

Like # people like this
David Niro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 5, 2022

So glad to hear it!  You're very welcome!!

Like Dave Rosenlund likes this
Jochen Berdi August 11, 2022

Hi David

Is it possible to only use the first 9 characters in the body for the status match?

 

Best regards 
Jochen

Like Dave Rosenlund likes this
Jochen Berdi August 11, 2022

Solved it as follows

With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")).UMAX_BY($.created) :

IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9),
" \\\\ " //paragraph break
)
)

The substring can now be BA or BR. How can I now make BA with background colour red and BA in green (panel function)?

Like # people like this
David Niro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2022

great work @Jochen Berdi!  Thank you for sharing the solution here!!

Like # people like this
Jochen Berdi August 11, 2022

And with Wiki Markup

With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")).UMAX_BY($.created) :

With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :


IF String = "BA":
Status_Match.map(
CONCAT(
"{panel:bgColor=#ADFF2F}",substring($.body,7,9),"{panel}"
))

ELSE IF String = "BR":
Status_Match.map(
CONCAT(
"{panel:bgColor=#ee0701}",substring($.body,7,9),"{panel}"
))

Like # people like this
Jochen Berdi August 12, 2022

keep it simple

With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")).UMAX_BY($.created) :

With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :


IF String = "BA":
"{panel:bgColor=#FFD433} BA {panel}"


ELSE IF String = "BR":
"{panel:bgColor=#ee0701} BR {panel}"

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events