Forums OroCRM OroCRM – Programming Questions Acessing Account info from Opportunity when sending an email

This topic contains 3 replies, has 2 voices, and was last updated by  Manuel Capinha 5 months, 4 weeks ago.

  • Creator
  • #22842

    Manuel Capinha


    I’ve setup a custom Opportunity workflow that sends emails at certain steps.
    On one of these steps I have to send an email containing information stored in the Account Entity, namely its name.

    My twig template is very simple:

    Entity is my Opportunity Entity and I can access its attributes with no problem. But trying to access entity.customerAssociation.account always throws an error:

    How can I access Account attributes from inside an action that sends email with send_email_template ?


Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
  • #22844


    Hi, Manuel Capinha.

    Can you provide configuration of your workflow and email template?
    Also, now I try to reproduce your issue to provide way to resolve it.



    I reproduced this issue. Created bug in our backlog (Internal ID: BAP-15117).

    Email rendered in twig sandbox and only allowed methods can be used inside.
    For unknown reason field of Opportunity entity not in list of allowed properties from default provider.

    For now you can try add new provider that should implement Oro\Bundle\EmailBundle\Provider\EntityVariablesProviderInterface and tag { name: oro_email.emailtemplate.variable_provider, scope: entity } and true to add required method to list of allowed methods of entity Oro\Bundle\SalesBundle\Entity\Customer.

    Thank you for reporting issue.


    Manuel Capinha

    Hi MSulima,

    I’ve been digging around and it seems that getVariableGetters() isn’t being called with Oro\Bundle\SalesBundle\Entity\Customer as parameter.
    I’ve managed to workaround it by directly injecting the needed methods in configureSandbox()..

    But most of the problem remains as I still can’t access extend attributes of my Account Entity, since their getter methods ain’t visible in the Account class :/

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.