Forums

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

Add bullets to each line of paragraph style smart value for confluence webhook

Michael Fortunato April 25, 2022

I have set up some automation rules that interact with each other to do the following:

  • Generate a standard release notes template in issues when transitioned to Done
    • Users will then fill in the template on their assigned issues
  • Identify issues ready for release based on their resolution date in relation to the end of the sprint
  • Format those release notes along with other issue information and create a confluence page

 

This is accomplished via a few rules:

  1. :Rule #1 creates the release notes template (screenshot below)
    1. release notes screenshot.jpg
  2. Rule #2 labels issues as ready_for_release if they meet certain time and resolution criteria
  3. Rule #3 looks up those issues and creates a webhook to create the confluence page (screenshot below):
    1. webhook screenshot.jpg

 

The issue is that {{Release notes comments.htmlEncode}} is a paragraph style field, and it appears like this in Jira:

release notes in jira screenshot.jpg

The resulting confluence only shows this as a single bullet, and I would like to bullet each line in the paragraph. I can put bullets in the release note template itself, but confluence doesn't seem to recognize these even when I use wiki style formatting (this appears to be a known Jira bug). See example below

confluence page.jpg

Any ideas for how I could get the webhook to bullet each line so it looks like the below?

expected confluence page.jpg

1 answer

0 votes
Bill Sheboy
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 Leaders.
April 25, 2022

Hi @Michael Fortunato -- Welcome to the Atlassian Community!

I suspect the Release Notes Comments field is losing its form of Jira markup and then getting re-interpreted when added to Confluence.

Have you considered splitting the field on line breaks and adding your own Confluence Markup for bullets: https://support.atlassian.com/confluence-cloud/docs/insert-confluence-wiki-markup/

Perhaps with: 

{{#Release notes comments.split("\n")}}* {{.}}{{/}}

Kind regards,
Bill

Michael Fortunato April 25, 2022

@Bill Sheboy Ahh thanks for the response. I was looking around to see if there was a way to identify line breaks. Let me try this out and see if it works.

Like Bill Sheboy likes this
Michael Fortunato April 25, 2022

@Bill Sheboy so it looks like Confluence just doesn't respect the markup from the webhook. It just outputs the unformatted "* ". However, if i edit the page and remove the space and put it back, it turns it into a bullet.

However, the below seems to get me closer to the solution:

{{#Release notes comments.split("\n")}}<ul><li>{{.}}</li></ul>{{/}}

Produces the below:

bullets screenshot.jpg

However, now I need to find a way to produce the next bullet (e.g., the answer to the release note template)

Is there anyway to create a list from {{#Release notes comments.split("\n")}}{{.}}{{/}}?

For instance, maybe create a list from certain elements of the list?

Bill Sheboy
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 Leaders.
April 25, 2022

Do you mean to add the * Notes list item after each comment line? 

If so, how about nesting within the iterator:

{{#Release notes comments.split("\n")}}<ul><li>{{.}}<ul><li>Notes</li></ul></li></ul>{{/}}
Michael Fortunato April 25, 2022

Sorry, Notes isn't an actual value. I just put it as a placeholder for the text a user will enter. I think I will need to create a smart value in the automation that creates that value. I am just not sure how to specifically identify only the text on the second level bullet points in the free text field.

Bill Sheboy
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 Leaders.
April 25, 2022

I also meant "Notes" as a placeholder...I was thinking people were entering the details on the Confluence page, and instead it appears you mean there could be 1-to-many "notes" entered in that field below each first-level bullet.  Correct?

Michael Fortunato April 25, 2022

Yes, correct. Basically, this template will be inserted into jira upon transition to Done. Then, the Assignee will insert another bullet level between each first bullet level in Jira. Then, the automation will pull all the information into a confluence for our customer teams to review. This way the information is documented in both places where all our relevant users can view.

So I suppose, I need a way to identify the sub-bullets and list them as a smart value. Not sure if this is possible

Bill Sheboy
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 Leaders.
April 25, 2022

Hmmm...this could be a brittle solution that might work:

If you used heading levels (h1, h2...) in the Jira field, those could be used as split groupings, with the first split on h1 and then process (nest) the result with a second split on line breaks and h2 (or just lines) to add the additional necessary HTML.

I definitely recommend experimenting by just writing to the audit log a bit on the splits to determine how well this works.

Michael Fortunato April 26, 2022

@Bill Sheboy Sorry, I am having trouble understanding why using heading levels will be different than bullets. 

Aren't headings just interpreted as (# or ## for h1 or h2) vs bullets are (* or ** for 1st or 2nd level)?

Do you have an example of what you are suggesting?

Bill Sheboy
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 Leaders.
April 26, 2022

If you write a field containing Jira markup to the audit log, you will see that bullets appear with a varying number of asterisks * (or pound signs #) and that heading levels are prefixed by h1, h2, etc.  Those are distinct enough to allow splitting on a header first and then bullets.

Although now that I think about it...I suppose you could also try to split on a regular expression with just one asterisk first, and then split on the child lines.  I'm gonna experiment with that one as split() is documented to accept a regular expression.

Update:

Scratch that idea: although it is possible to split on the h1 markup, it is not possible to split again/lower as unstructured data like text has no smart values to grab onto...only {{.}} in the iterator.  Same problem using a regular expression to split on different bullet levels.

 

Michael Fortunato April 26, 2022

I'm testing out a couple different methods. Would like your thoughts.

 

  1. Use match to get the elements that match the "** " pattern, write them to a separate issue field, refetch issue data, then use the smart value for the new custom field to populate the second bullet
  2. Use a conditional on the existing release notes field. A conditional of the sort:
{{ #if(lookupIssues.Release notes comments.split("\n").match(".*(\*\* [a-zA-Z0-9]+[^,]).*").size.gt(0))}}<ul><li>{{.}}</li></ul>{{ /}}

 Not sure if that conditional would work or if I got it completely correct

Bill Sheboy
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 Leaders.
April 26, 2022

That smart value expression looks well-formed, and I don't know if it will work.  You may need to experiment a bit and test this.

My understanding of your use case was something like below, and so I thought the nesting of lower level bullets (e.g. sub items) would prevent syncing them later in the output with their "parent" if they were extracted.

  • here is some text
    • here is a sub item 
    • here is another sub item
  • here is more text
    • this one has just one sub item

In this example pulling out all of the ** sub items would disconnect them from the parent and so they could not be synched later on the Confluence output.

Michael Fortunato April 26, 2022

No your understanding is correct, and that is what I need. That is why I'm thinking my first thought won't work, but the second might. The other alternative is maybe creating a list of name/value pairs in json and then splitting that way, but I really am not familiar with how to operate on those fields

Like Bill Sheboy likes this
Bill Sheboy
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 Leaders.
April 26, 2022

Sorry, I am out of ideas for this one.  The markup differences is one problem and solutions with list iterators cannot easily be nested when there isn't structure to grab.

If those template/placeholder sections are stable, the safest approach may be independent custom fields, which you can manipulate easily onto the Confluence layout.

Suggest an answer

Log in or Sign up to answer