How to insert the comment content of a permalink using Nunjuks in JMWE ?

André Habran April 10, 2019

Hello there,

I am a novice in the practice of Nunjucks.
I would like to create a transition Comment Issue (JMWE add-on) to add a comment from a comment on a specific ticket and always the same. This would allow me to outsource the original standard comment message without having to change the programming of the transition.

Maybe using PermaLink?

Thank you for your help or advice

André

1 answer

0 votes
André Habran April 10, 2019

Hi,

Using Comment linked issues (JMWE add-on) Function, I found how to get the first comment of the issue and copy it to the parent issue.

{{ issue.fields.comment.comments | first | field("body") }}

However, I can not choose a specific issue where the original comment is. Only the current issue.
However, with Test Nunjuks Template, you can target any issue for testing.

Is there a way to access fields from a specific issue instead of the current issue?

Thank you for the answer.

André

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 15, 2019

Hi André,

which issue are you trying to access?

You can access the parent of the current issue, it's linked issues and sub-tasks, etc. Or you can access arbitrary issues using the searchIssues Nunjucks filter that allows you to run a JQL expression that returns one or more issues. 

André Habran April 15, 2019

Hi David,

Thx for your answer.

 

WRT Parent and linked issue, I am using fluently, np.

For now, template comment is hard-coded into JMWE transistion but I would like to externalize it to allow my colleague to dynamically edit the original.

Yes, I need to access arbitrary issues using searchissue. Where can I find some samples as examples ? I am self-taught in developing my own tool. Not so easy :-)

I appreciate your support.

Regards

André

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 16, 2019

There are some examples in the documentation: https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/138405679/Custom+Nunjucks+filters#CustomNunjucksfilters-searchIssues

As for externalizing the template comment, you can use a shared Nunjucks template.

André Habran January 15, 2020

Hi David,

I am trying your advice through using searchIssues Nunjunks filter but as I am not really an expert, that's the word, I am not able to use the result of this instruction:

"issue=HDF-2" | searchIssues (fields="summary") | dump(2)

The test template ran successfully inside a Set field value post-function and I get 

[
  {
    "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
    "id": "48259",
    "self": "https://zenelec.atlassian.net/rest/api/2/issue/48259",
    "key": "HDF-2",
    "fields": {
      "summary": "ILLUDESIGN SPRL (HDF-2)"
    }
  }
]

But then, how to get the string content of the field summary ?

Thx for your answer

André

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 15, 2020

Hi André,

I believe this is what you're looking for:

{{"issue=HDF-2" | searchIssues (fields="summary") | first | field("fields.summary")}}
André Habran January 15, 2020

YESSSS

you make my day very good.
How many times have I not tried combinations!

Have a nice day too :-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events