3

I have a front end form for logged in users to submit new entries. I want that user to receive a notification (via Sprout Email) that there entry has been received (it's pending/disabled on submission).

I'm struggling with what my recipient variable should be!?

I should add, it's the logged in user that added the entry that I want to receive the notification.

2

Sprout Email allows Craft Object Syntax for the object that is available when an event is triggered, in the same way you would use the Sections Title Format field.

If your form is submitting an Entry the dynamic object being submitted is an EntryModel and all values from that EntryModel will be available to several of your fields in Sprout Email. To access those values you can use one of two syntaxes:

  1. Shorthand Object Syntax

{title} or {customFieldHandle}

  1. Object Syntax

{{ object.title }} or {{ object.customFieldHandle }} - this longer form can also be used in more advanced twig constructs like {% if object.title %}

Both of these syntaxes are comparable to how you would use {{ entry.title }} or {{ entry.customFieldHandle }} in your templates.

This is described with a few more examples on the Dynamic Values page of the docs

| improve this answer | |
  • Thanks for the reply. So to send the user that submitted the entry form (and is therefore the author) I should use {author.email} or {object.author.email} in the recipient field presumably? – shorn Mar 20 '17 at 15:18
  • Close: {author.email} or {{ object.author.email }}. The shorthand syntax get's processed and wrapped with the double curlies and object variable prefix: {author.email} => {{ object.* }} where * is the value you provide author.email – Ben Parizek Mar 20 '17 at 17:48
  • Just testing this out. The notification works from the CP, however, when I submit my form from the front end I get the following error Argument 1 passed to Craft\SproutEmail_NotificationEmailsService::relayNotificationThroughAssignedMailer() must be an instance of Craft\SproutEmail_NotificationEmailModel, null given, called in /Users/Me/Sites/MySite/craft/plugins/sproutemail/services/SproutEmail_NotificationEmailsService.php on line 442 – shorn Mar 21 '17 at 0:40
  • @shorn - Sounds like this is a new issue and the immediate question above is addressed. To understand more info about your setup to help further, can you send us a support ticket with details about what versions of Craft and Sprout Email you are on and any relevant logs and template files that would be helpful to understand what you are doing. In addition, it would be good to see the settings you have prepared in your notification email and understand any other steps we would need to know about to recreate your issue. sprout.barrelstrengthdesign.com/craft-plugins/request/support – Ben Parizek Mar 21 '17 at 1:54
  • Thanks Ben. Started again and seems to working following the above help. Thanks. – shorn Mar 27 '17 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.