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-03-22 12:28:57

ph.adam
Member
Registered: 2020-11-02
Posts: 31

Loops in template variables

Hello,

How could one loop trough ticket assignees and only show the first element of this array?
I would like to create a template that will include a signature. But if the ticket is assigned to more than one techician I only want the first technician to be included in the signature.


{% for user in ticket.assignees.users %}

{{ user.fullname }}
{{ user.usertitle.name }}
Tél. : {{ user.phone }}
GSM : {{ user.mobile }}

{% endfor %}

Do you have any idea on how to do this please?
Docs only show "old" syntax ##FOREACH and I can't manage to make it work with ##FOREACH FIRST 1 USERS##.

Thank you in advance

Offline

#2 2024-03-22 21:44:41

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

Re: Loops in template variables

Which templates are you referring to? Notifications still use the custom syntax you reference with tags like "##FOREACH".


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

#3 2024-03-27 09:25:02

ph.adam
Member
Registered: 2020-11-02
Posts: 31

Re: Loops in template variables

Notification templates. Ok, is this the right syntax? ##FOREACH FIRST 1 USERS## ?

Thank you

Offline

Board footer

Powered by FluxBB