Using R4J plugin, I'm unable to display the project field of a linked issueson a Word template

Laurent PIANFETTI November 2, 2023

Hello.

I'm trying to generate a specification document from my R4J Tree and I'm facing a issue when, for each issue of the tree, I try to display and use the project of a linked issue : null exception in the generated document.

Here is the extract of my template that generates the issue :

[[\if $.linkedissues.count > 0]]Linked requirements:
[[\variable.link_requirement ‘TRUE’]][[/variable]]
[[\each $.linkedissues]]
[[\if $.name = “contributes to”]]
Contributes to “[[$.issue.summary]]” ([[$.issue.key]]) [[$.issue.project]]
[[\\wiki $.issue.description]] [[/wiki]]
[[\variable.link_requirement ‘FALSE’]][[/variable]]
[[/if]]
[[/each]]
[[\if $variable.link_requirement = ‘TRUE’]]
None.
[[/if]]

Thank for your help

1 answer

0 votes
Angelica Salazar
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.
November 3, 2023

Hi @Laurent PIANFETTI

[[\if $.linkedissues.count > 0]]Linked requirements:

[[\variable.link_requirement ‘TRUE’]][[/variable]]

  [[\each $.linkedissues]]

   [[\if $.name = “contributes to”]]

      Contributes to “[[$.issue.summary]]” ([[$.issue.key]]) [[$.issue.project]]

      [[\wiki $.issue.description]] [[/wiki]]

      [[\variable.link_requirement ‘FALSE’]][[/variable]]

      [[/if]]

  [[/each]]

[[\if $variable.link_requirement = ‘TRUE’]]

None.

[[/if]]

[[/if]]

I tested this block of code that you have, and it does work. I just added a closing if block at the end.

If it's not working for you, there may be other parts of your template causing the null exception, so we'd need to have a look at your entire template.

If you require more assistance, our friendly support team will be happy to help!

Best regards,
Angelica

Laurent PIANFETTI November 6, 2023

Thank for your help @Angelica Salazar 
Here is my code :
```

 

[[\template issueDetails]]

[[\variable.project $.project]][[/variable]]

URL de l’exigence : [[$.url]]

Description

[[\wiki $.description]][[/wiki]]

[[\if $.description = “”]]Pas de description[[/if]]

 

[[\if $.attachments.count > 0]]Pièces jointes :

[[\each $.attachments]]

  • [[$.]]

[[/each]]

[[/if]]

[[\if $.linkedissues.count > 0]]Exigences liées :

[[\variable.link_requirement ‘TRUE’]][[/variable]]

[[\each $.linkedissues]]

[[\if $.name = “contributes to”]]

Contribue à l’exigence “[[$.issue.summary]]” ([[$.issue.key]])

[[\\wiki $.issue.description]] [[/wiki]]

 

[[\variable.link_requirement ‘FALSE’]][[/variable]]

[[/if]]

[[/each]]

[[\if $variable.link_requirement = ‘TRUE’]]

Aucune.

[[/if]]

[[\variable.link_requirement ‘TRUE’]][[/variable]]

Autres liens :

[[\each $.linkedissues]]

[[\if $.name = “relates to”]]

Est liée à l’exigence “[[$.issue.summary]]” ([[$.issue.key]])

 

[[\variable.link_requirement ‘FALSE’]][[/variable]]

[[/if]]

[[/each]]

[[\if $variable.link_requirement = ‘TRUE’]]

Aucun.

[[/if]]

[[/if]]

 

[[/template]]

 

[[\each $selectedProject]]

[[\recurse $.folders]]

[[\levelheading $.name]]

[[\wiki $.description]][[/wiki]]

[[\recursehere]][[/recursehere]]

[[\variable.parent $.key]][[/variable]]

[[\recurse $.folderissues]]

[[\levelheading “(“ + $.issuetype + “) “ + $.summary]]

[[\apply-template issueDetails]][[/apply-template]]

[[\variable.project $.project]][[/variable]]

[[/levelheading]]

[[/recurse]]

[[/levelheading]]

[[/recurse]]

[[/each]]

```

Angelica Salazar
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.
November 7, 2023

Hi @Laurent PIANFETTI

I just copied your code into a Word document and tried to use it. It works fine for me. I am able to export without the null exception you mentioned.

Can you share the exact error you're experiencing? 

Best regards,
Angelica

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events