Sprout Forms - Custom Form Notification Recipients With sproutForms.onBeforeSaveEntry I've got an existing service based site that uses Sprout Forms to request quotes. The quote form lives on all services pages in a sidebar (and the submissions have an entries field keeping track of which service the submission came from).

I've just added some fields into the services entry to allow them to override where the quote form goes.



Now I need to make this work. I have a plugin listening for sproutForms.onBeforeSaveEntry events, and when it receives them I'm wanting it to adjust where it sends the notification to.

Is this possible? Is it possible to modify notificationRecipients on an individual event or is this against the form (and in either case how do I do this if I have a SproutForms_OnBeforeSaveEntryEvent)?

In either case (as I can live with the former) a code example would be amazing.
Based on the event you are referencing, I believe this is a question about Sprout Forms for Craft 2. In Sprout Forms for Craft 3, notifications are handled a differently.

In Sprout Forms for Craft 2, the event you'll want to use for this is the SproutForms_OnBeforePopulateEntryEvent.

You're not able to modify which value gets set directly, so you'll have to swap in the value you want using Craft Object syntax.

In your notificationRecipients field, add a value using Craft Object Syntax: {myRecipientsEmail}. Once you have called sproutForms.onBeforePopulateEntryEvent you can modify the $_POST data that gets processed when assigning the recipient value and it sure it has the value you want: $_POST['myRecipientsEmail'] = 'so-and-so@website.com'