You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2024-04-05 13:06:11

dfper
Member
Registered: 2020-12-28
Posts: 8

Using twig tags for knowledge base content on tasks/followups

Hi everyone,
I'm working with the latest version of GLPI and trying to use Twig tags to automatically include content from linked knowledge base items within task/followup templates. Here's my current code:
{% for user in ticket.requesters.users %} {{ user.fullname }}

This doc will help you: {% for knowbaseitem in ticket.knowbaseitems %} {{ knowbaseitem.link | raw }}

{{ knowbaseitem.answer | raw }}

{% endfor %}

{% endfor %}

Unfortunately, when I use this template, the knowledge base content doesn't appear. Does anyone have a working example of how to successfully pull knowledge base item content into templates using Twig tags?
Thanks in advance for any help!

Offline

#2 2024-07-19 22:47:37

rcgjoxph
Member
Registered: 2024-07-19
Posts: 7

Re: Using twig tags for knowledge base content on tasks/followups

Hello, what you may have been seeing is GLPI issue 17549 on github entitled "ticket.knowbaseitems gets knowbaseitems by id not knowbaseitems_id from knowbaseitem_item" . I would link, but the forum doesn't allow it.

If the values of the id field in glpi_knowbaseitem_item didn't happen to match any of your KB articles' ids, you'd have seen nothing as you describe.

Offline

#3 2024-07-21 00:07:11

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,809
Website

Re: Using twig tags for knowledge base content on tasks/followups


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

Board footer

Powered by FluxBB