Forums OroCRM How to Dynamically configure email templates in process.yml for email triggers:

This topic contains 1 reply, has 1 voice, and was last updated by  shreyas 1 year, 4 months ago.

  • Creator
  • #27350


    Hi Team,
    I have a requirement wherein I need to create an dynamically configurable email template in a process.yml file which consists of email trigger when a new lead is created. i.e required since if an admin needs to change the email template used to send email to leads when they are created then he needs to go to the code to change the template string to a new one.
    So, to avoid this i have created an entity called CustomConfig entity with cols as config value & config label where label i would like to keep it constant & the value can be changed.
    So ex: a label is kept as : Lead_Creation_Template , it can be given any email template value. So that it has dynamic configuring of when a lead is created which template to be selected.

    i tried using this entity to fetch the Config – value for a given config label (i.e, Lead_Creation_Template) in the processes but i am getting exceptions while doing so.

    i am able to trigger mail when a lead is created when the template set in @send_email_template is set to a email template string format. but when i try to use customconfig’s value variable to get the same email template name , it throws an exception.
    Please find the screenshot for CustomConfig Entity Colums containing Config Label & Config Value given below:
    Custom Config Entity

    Custom Config Entity file given below(Loc: Proj_Dir\src\Custom\Bundle\CustomConfigBundle\Entity\CustomConfig.php):

    Please find the process.yml used to trigger email:

    Once now when i create a lead , i get a job failed message in http://Proj_Dir/app_dev.php/cron/job as shown below:
    Cron Job Error

    In the above Process.yml , if i use template: ‘Avez-vous reçu nos mails?’ instead of template: $customconfig.configvalue . It works perfectly fine.I dont know on how exactly to map the Customconfig entity’s Configvalue to the template variable of @send_email_template.

    Please need some help in how to solve this problem.
    Thanks & Regards,
    Shreyas S

Viewing 1 replies (of 1 total)
  • Author
  • #27351


    Hi Team,
    The issue is resolved now.Please find below the process.yml changed file given below:

    After this, i run the command to cache clear & then did: app/console oro:process:configuration:load
    The issue was i had used the attribute as $customconfig instead of using

    Now its working as expected.Thanks Team.

    Thanks & Regards,
    Shreyas S

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.