OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums 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 6 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #25451

    Manuel Capinha
    Participant

    Hi,

    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 ?

    Regards,
    Manuel

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

    msulima
    Moderator

    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.


    #25453

    msulima
    Moderator

    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.


    #25454

    Manuel Capinha
    Participant

    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)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top