The issue in my script arises from incorrect usage of the Smarty variable to access the host alias (host_alias). While I correctly utilized the $service.host_name variable to display the host name, attempting to use $service.host_alias to display the host alias failed because the variable was not defined.
Here's the problematic part of the code:
{foreach from=$service_selected item=service}
Host: {$service.host_name}
MasterID: {$service.host_alias}
Service: {$service.description}
State: {$service.state_str}
Duration: {$service.last_hard_state_change_duration}
Output: {$service.output|substr:0:2048}
Numéro de série: {$service.serial_number}
Version du logiciel: {$service.software_version}
Dernière vérification: {$service.last_check_time}
{/foreach}
The ticket looks like this
To resolve this issue, I need to ensure that the host_alias variable is correctly defined in my data. I can achieve this by retrieving it from my database or properly assigning it in my Smarty code if it's available in the current context. If the host_alias variable is missing, I should consider adjusting my SQL query or logic to include this information.
Furthermore, I need to verify that the column name in my SQL query aligns with the variable name in Smarty to facilitate correct data assignment and display in my template.
Can someone help me troubleshoot this problem and suggest a solution?

Issue Description: I am encountering an issue with my script where I'm trying to access the host alias (host_alias) using a Smarty variable, but it's not working as expected. I have successfully used the $service.host_name variable to display the hostname, but when I attempt to use $service.host_alias to display the host alias, it fails because the variable is not defined or populated.
Problematic Code:(smarty)
The result: