Field description in e-mail template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alfo007
    Junior Member
    • Feb 2026
    • 2

    #1

    Field description in e-mail template

    Hi, When I create an email or PDF template, if the field from which I take the data is enum type, how do I get the field description to be output instead of the value?
    I’m using EspoCRM 9.3.0 free version.
    Many thanks
  • Juantreses
    Junior Member
    • Aug 2025
    • 25

    #2
    What I have done for my e-mail templates is to make a custom placeholder.

    it's a class that implements Espo\Tools\EmailTemplate\Placeholder
    I will try to put it in pseudocode for you here

    PHP Code:
    <?php

    namespace Espo\Modules\YourModule\Tools\EmailTeplate\Placeholders;

    use 
    Espo\Modules\Crm\Entities\YourEntity;
    use 
    Espo\Tools\EmailTemplate\Data;
    use 
    Espo\Tools\EmailTemplate\Placeholder;

    class 
    yourIntendedData implements Placeholder
    {
        public function 
    get(Data $data): string
        
    {
            
    $entityHash $data->getEntityHash();
            
    $yourEntity $entityHash[Meeting::ENTITY_TYPE] ?? null;
            if (!
    $yourEntity) {
                return 
    '';
            }
            
            return 
    $yourEntity->get('yourValue');
        }
    }

    Comment

    • yuri
      EspoCRM product developer
      • Mar 2014
      • 9656

      #3
      Hello, What do you mean by 'the field description'?

      Comment


      • Juantreses
        Juantreses commented
        Editing a comment
        My guess is they want their enum key in their template instead of the value
    Working...