Workflow notificationSettings


#1

Hi
I am trying to send email after a transition and I get the following error on initialize:
Unrecognized option “notificationSettings” under “pimcore.workflows.workflow.transitions.reject_product”
What am I doing wrong?
Thanks
Eli

config.yml
                           transitions:
                    reject_product:
                        from: new
                        to: rejected
                        options:
                            label: 'Reject the product'
                            notes:
                                commentEnabled: true
                                commentRequired: true
                        notificationSettings:
                            notifyUsers: ['admin']
                            mailType: 'template' 
                            mailPath: '@PimcoreCore/Workflow/NotificationEmail/notificationEmail.html.twig'

#2

Hi @EliShklovsky,

Not sure, but I think you have to indent the notificationSettings into the next level under the options group. As far as I can see, right now they are directly under reject_product.


#3

Hi Aaron,
I Tried this, unfortunately I get other error:

Unrecognized option “0” under “pimcore.workflows.workflow.transitions.reject_product.options.notificationSettings.notifyUsers”


#4

Hi
Maybe I’ll try using the event on each place or transition:

AppBundle\EventListener\WorkFlowRejectEnter:
tags:
- { name: kernel.event_listener, event: workflow.workflow.entered.rejected, method: onEnter }

This fire the event but it is a pity not using the notification settings in the workflow. not to mention that using the ability to use user groups, mail path etc.

btw, this should be in another thread:
I tried in the fired event class this:

  $mail = new \Pimcore\Mail();
  $mail->addTo('eli@netgo-ltd.co.il');
  $mail->setBodyText("This is just plain text");
  $mail->send();

but i got an error:
error performing action on this element
Process could not be started [The system cannot find the path specified. ]

Did I forget to initialize something?


#5

Hi,
does sending a mail work for you outside of the transition event?


#6

And I am assuming it doesn’t. Check you System Settings for email (Email method etc). This error message seems to be coming from SwiftMailer.


#7

Hi All,
I set the email on the system settings (used SMTP) and that worked for sending email from the event code.

As for the WorkFlow configuration:
I found my mistake on config.yml:
I forgot to add the - (minus) under the notificationSettings:

    reject_product:
                        from: new
                        to: rejected
                        options:
                            label: 'Reject the product'
                            notes:
                                commentEnabled: true
                                commentRequired: true
                            notificationSettings:
                            -
                                notifyUsers: ['eli']
                                mailType: 'template' 
                                mailPath: '@PimcoreCore/Workflow/NotificationEmail/notificationEmail.html.twig' 

Now It is working as it should be!

Aaron and Ivan: thanks for trying to help

Thanks
Eli