Reputation: 1309
I have a form at my website where the user can request for information, but there's a catch. Inside the form I have a checkbox and when the user selects it, the email must to be sent to another place. (See the screenshots)
What's happening is: Gravity form sends both emails when both rules match, but I only wanna send one email based on the priority. How can I do that?
Upvotes: 0
Views: 425
Reputation: 24661
I don't believe the routing will take into account AND conditions for the individual rules.
You can however, use the following filter to do further modifications to the e-mail before it is being sent:
add_filter("gform_notification", "my_custom_function", 10, 3);
Or, for a specific form (i.e. id = 42):
add_filter("gform_notification_42", "my_custom_function", 10, 3);
Source: http://www.gravityhelp.com/documentation/page/Gform_notification
Update
An example of accessing the fields would look like this:
add_filter('gform_notification_42', 'updateNotificationForForm42', 10, 3);
function updateNotificationForForm42( $notification, $form, $entry ) {
$fields = $form['fields'];
foreach( $fields as $field ) {
// Here you need to provide the field with some kind of identifying mark (e.g., Admin Label).
// Below assumes the field you're interested in has an admin label of 'Test Me'
if( $field['adminLabel'] == 'Test Me' ) {
$fieldValue = rgpost("input_{$field['id']}");
}
}
}
The Gravity Forms developer docs have a lot of examples of how to customize via actions/filters.
See Also: http://www.gravityhelp.com/documentation/page/Fields
Upvotes: 2