Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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é

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. 

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é

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.

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é

Hi André,

I believe this is what you're looking for:

{{"issue=HDF-2" | searchIssues (fields="summary") | first | field("fields.summary")}}

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
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

265 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you