You are not logged in.
listSearchOptions does not return the field called Id. I need to get the item Id when using listSearchOptions forcedisplay option.
Can someone please assist?
Offline
Iwould say "id" is allways index 2 forcedisplay[x]=2
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
Hi LaDenrée,
I tried as you suggested. But it doesn't return id field in the search/computer method. In the listSearchOptions also index 2 is missing with some other indexes (like 3,7).
Offline
myserver/glpi/apirest.php/listSearchOptions/Computer/
returns
{"common":{"name":"Caractéristiques"},
"1":{"name":"Nom","table":"glpi_computers","field":"name","datatype":"itemlink","nosearch":false,"nodisplay":false,"available_searchtypes":["contains","notcontains","equals","notequals"],"uid":"Computer.name"},
"2":{"name":"ID","table":"glpi_computers","field":"id","datatype":"number","nosearch":false,"nodisplay":false,"available_searchtypes":["contains","notcontains"],"uid":"Computer.id"},
"3":{"name":"Lieu","table":"glpi_locations","field":"completename","datatype":"dropdown","nosearch":false,"nodisplay":false,"available_searchtypes":["contains","notcontains","equals","notequals","under","notunder"],"uid":"Computer.Location.completename"},"101":{"name":"Adresse","table":"glpi_locations","field":"address","datatype":"string","nosearch":false,"nodisplay":false,"available_searchtypes":["contains","notcontains"],"uid":"Computer.Location.address"},"102":{"name":"Code postal","table":"glpi_locations","field":"postcode","datatype":"string","nosearch":false,"nodisplay":false,"available_searchtypes":["contains","notcontains"],"uid":"Computer.Location.postcode"}, [...]
index 2 is in the response
Trouver la panne avant de réparer...
GLPI10.0.16 (ubuntu 22.04 PHP8.1 Mariadb10.6 ) plugins : comportements 2.7.3 reports 1.16.0 formcreator 2.13.9, datainjection 2.13.5 fields 1.21.9
Offline
Yes, I have tried this in the local dev setup. It works as you mentioned. However, the production server is not returning these fields. The ID field is missing in the response. Maybe because of a GLPI configuration error?
Offline
I cannot recreate the issue. Is your dev setup a different GLPI or PHP version? Also, the order of the options returned is not guaranteed to be in numeric order based on the ID.
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