Email: Customize Layout / Set Default Account

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tobias
    Senior Member
    • May 2016
    • 229

    Email: Customize Layout / Set Default Account

    Hi folks,

    Two questions:
    1. Is it possible to add a column to the email layout, containing the recipient's email address next to the sender's address (see screenshot, where only the sender support@pinpoll.com is shown in a column)?
    2. Is it possible to set the group email account being the default account for sending emails, in case one user has both a personal and group email account?

    Thanks for your help.
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi,

    1. Only manually application/Espo/Resources/layouts/Email. Copy list layout to custom/Espo/Custom/Resources/layouts/Email
    2. Not supported.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • tobias
      Senior Member
      • May 2016
      • 229

      #3
      Thanks for the quick reply.

      As for the custom layout, this is what I did:
      1. cp application/Espo/Resources/layouts/Email/list.json custom/Espo/Custom/Resources/layouts/Email/list.json
      2. vi custom/Espo/Custom/Resources/layouts/Email/list.json
      3. php rebuild.php
      As for step 2, I've added the column to list.json (bold) :
      [
      {"name":"personStringData","width":16,"notSortable": true, "customLabel": ""},
      {"name":"to","width":35,"link":true,"notSortable": true},
      {"name":"subject","width":35,"link":true,"notSortable": true},
      {"name":"status","notSortable": true, "width":10},
      {"name":"parent","notSortable": true, "width": 16},
      {"name":"dateSent","view": "views/fields/datetime-short", "notSortable": true, "width":10, "align": "right"}
      ]

      However, "to" doesn't load the recipient.

      Any idea?

      - Tobias

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #4
        application/Espo/Services/Email.php


        Add $this->loadToField($entity); into loadAdditionalFieldsForList
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • tobias
          Senior Member
          • May 2016
          • 229

          #5
          Thanks for getting back. However, it still won't work.

          Have I placed $this->loadToField($entity) correctly?


          Code:
           [FONT=Monaco][SIZE=10px]    [COLOR=#34bd26]public[/COLOR] [COLOR=#d53bd3]function[/COLOR] loadAdditionalFieldsForList[COLOR=#d53bd3]([/COLOR]Entity [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#d53bd3])[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]    [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]        [COLOR=#34bd26]parent[/COLOR][COLOR=#ce7924]::[/COLOR]loadAdditionalFieldsForList[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px] [/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]this[/COLOR][COLOR=#34bd26]->[/COLOR]loadToField[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#d53bd3])[/COLOR]; [COLOR=#5330e1]//Pinpoll[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px] [/SIZE][/FONT]
            [COLOR=#34BBC7][FONT=Monaco][SIZE=10px][COLOR=#000000]        [/COLOR][COLOR=#ce7924]$[/COLOR]userEmailAdddressIdList[COLOR=#000000] [/COLOR][COLOR=#ce7924]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#d53bd3][][/COLOR][COLOR=#000000];[/COLOR][/SIZE][/FONT][/COLOR]
            [FONT=Monaco][SIZE=10px]        [COLOR=#ce7924]foreach[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]this[/COLOR][COLOR=#34bd26]->[/COLOR]getUser[COLOR=#d53bd3]()[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]emailAddresses[/COLOR]'[COLOR=#d53bd3])[/COLOR] [COLOR=#ce7924]as[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]ea[/COLOR][COLOR=#d53bd3])[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [COLOR=#34BBC7][FONT=Monaco][SIZE=10px][COLOR=#000000]            [/COLOR][COLOR=#ce7924]$[/COLOR]userEmailAdddressIdList[COLOR=#d53bd3][][/COLOR][COLOR=#000000] [/COLOR][COLOR=#ce7924]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#ce7924]$[/COLOR]ea[COLOR=#34bd26]->[/COLOR][COLOR=#000000]id;[/COLOR][/SIZE][/FONT][/COLOR]
            [FONT=Monaco][SIZE=10px]        [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px] [/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]status[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]status[/COLOR]'[COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [COLOR=#34BBC7][FONT=Monaco][SIZE=10px][COLOR=#000000]        [/COLOR][COLOR=#ce7924]if[/COLOR][COLOR=#000000] [/COLOR][COLOR=#d53bd3]([/COLOR]in_array[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR]entity[COLOR=#34bd26]->[/COLOR][COLOR=#000000]get[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#000000]'[/COLOR][COLOR=#c33720]fromEmailAddressId[/COLOR][COLOR=#000000]'[/COLOR][COLOR=#d53bd3])[/COLOR][COLOR=#000000], [/COLOR][COLOR=#ce7924]$[/COLOR]userEmailAdddressIdList[COLOR=#d53bd3]))[/COLOR][COLOR=#000000] [/COLOR][COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT][/COLOR]
            [FONT=Monaco][SIZE=10px]            [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]loadLinkMultipleField[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]toEmailAddresses[/COLOR]'[COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]            [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]idList[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]toEmailAddressesIds[/COLOR]'[COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [COLOR=#C33720][FONT=Monaco][SIZE=10px][COLOR=#000000]            [/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]names[/COLOR][COLOR=#000000] [/COLOR][COLOR=#ce7924]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR][COLOR=#000000]get[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#000000]'[/COLOR]toEmailAddressesNames[COLOR=#000000]'[/COLOR][COLOR=#d53bd3])[/COLOR][COLOR=#000000];[/COLOR][/SIZE][/FONT][/COLOR]
            [FONT=Monaco][SIZE=10px] [/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]            [COLOR=#ce7924]if[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]!empty[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]idList[/COLOR][COLOR=#d53bd3]))[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]arr[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#d53bd3][][/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#ce7924]foreach[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]idList[/COLOR] [COLOR=#ce7924]as[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]emailAddressId[/COLOR][COLOR=#d53bd3])[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]this[/COLOR][COLOR=#34bd26]->[/COLOR]getEntityManager[COLOR=#d53bd3]()[/COLOR][COLOR=#34bd26]->[/COLOR]getRepository[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]EmailAddress[/COLOR]'[COLOR=#d53bd3])[/COLOR][COLOR=#34bd26]->[/COLOR]getEntityByAddressId[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]emailAddressId[/COLOR][COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#ce7924]if[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR][COLOR=#d53bd3])[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]arr[/COLOR][COLOR=#d53bd3][][/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]name[/COLOR]'[COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#d53bd3]}[/COLOR] [COLOR=#ce7924]else[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]arr[/COLOR][COLOR=#d53bd3][][/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]names[/COLOR][COLOR=#ce7924]->$[/COLOR][COLOR=#34bbc7]emailAddressId[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]set[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]personStringData[/COLOR]', '[COLOR=#c33720]To: [/COLOR]' [COLOR=#ce7924].[/COLOR] [COLOR=#34bbc7]implode[/COLOR][COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720], [/COLOR]', [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]arr[/COLOR][COLOR=#d53bd3]))[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]            [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]        [COLOR=#d53bd3]}[/COLOR] [COLOR=#ce7924]else[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [COLOR=#34BBC7][FONT=Monaco][SIZE=10px][COLOR=#000000]            [/COLOR][COLOR=#ce7924]$[/COLOR]fromEmailAddressId[COLOR=#000000] [/COLOR][COLOR=#ce7924]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#ce7924]$[/COLOR]entity[COLOR=#34bd26]->[/COLOR][COLOR=#000000]get[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#000000]'[/COLOR][COLOR=#c33720]fromEmailAddressId[/COLOR][COLOR=#000000]'[/COLOR][COLOR=#d53bd3])[/COLOR][COLOR=#000000];[/COLOR][/SIZE][/FONT][/COLOR]
            [COLOR=#34BBC7][FONT=Monaco][SIZE=10px][COLOR=#000000]            [/COLOR][COLOR=#ce7924]if[/COLOR][COLOR=#000000] [/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]!empty[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR]fromEmailAddressId[COLOR=#d53bd3]))[/COLOR][COLOR=#000000] [/COLOR][COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT][/COLOR]
            [FONT=Monaco][SIZE=10px]                [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]this[/COLOR][COLOR=#34bd26]->[/COLOR]getEntityManager[COLOR=#d53bd3]()[/COLOR][COLOR=#34bd26]->[/COLOR]getRepository[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]EmailAddress[/COLOR]'[COLOR=#d53bd3])[/COLOR][COLOR=#34bd26]->[/COLOR]getEntityByAddressId[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]fromEmailAddressId[/COLOR][COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#ce7924]if[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR][COLOR=#d53bd3])[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]set[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]personStringData[/COLOR]', [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]person[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]name[/COLOR]'[COLOR=#d53bd3]))[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#d53bd3]}[/COLOR] [COLOR=#ce7924]else[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]fromName[/COLOR] [COLOR=#ce7924]=[/COLOR] [COLOR=#34bd26]self[/COLOR][COLOR=#ce7924]::[/COLOR]parseFromName[COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]fromString[/COLOR]'[COLOR=#d53bd3]))[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#ce7924]if[/COLOR] [COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]!empty[/COLOR][COLOR=#d53bd3]([/COLOR][COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]fromName[/COLOR][COLOR=#d53bd3]))[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]set[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]personStringData[/COLOR]', [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]fromName[/COLOR][COLOR=#d53bd3])[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#d53bd3]}[/COLOR] [COLOR=#ce7924]else[/COLOR] [COLOR=#d53bd3]{[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                        [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]set[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]personStringData[/COLOR]', [COLOR=#ce7924]$[/COLOR][COLOR=#34bbc7]entity[/COLOR][COLOR=#34bd26]->[/COLOR]get[COLOR=#d53bd3]([/COLOR]'[COLOR=#c33720]fromEmailAddressName[/COLOR]'[COLOR=#d53bd3]))[/COLOR];[/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                    [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]                [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]            [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]        [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]
            [FONT=Monaco][SIZE=10px]    [COLOR=#d53bd3]}[/COLOR][/SIZE][/FONT]

          Comment

          • yuri
            Member
            • Mar 2014
            • 8440

            #6
            Seems it is correct
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • tobias
              Senior Member
              • May 2016
              • 229

              #7
              Yes, but it still doesn't add the column. Instead, personStringData seems to be overwritten (see screenshot).

              Any other ideas?

              Comment

              • yuri
                Member
                • Mar 2014
                • 8440

                #8
                Try to copy code lines from loadAdditionalFields one by one
                If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                Comment

                Working...