Support

Account

Home Forums General Issues Using ACF Email Field for Gravity Forms Notifications Reply To: Using ACF Email Field for Gravity Forms Notifications

  • I blame my lazy fingers for the transposition in notification.

    After some minor modifications – and fixing typos, I got this working using my second example above:

    add_filter( 'gform_notification_55', 'acf_email', 10, 3);
    function acf_email ($notification, $form, $entry){
    	$post_id = rgar($entry, '14');
        GFCommon::log_debug( __METHOD__ . '(): Running for Form 55.' );
        GFCommon::log_debug( __METHOD__ . '(): The Entry => ' . print_r( $entry, true ) );
        GFCommon::log_debug( __METHOD__ . '(): The Notification => ' . print_r( $notification, true ) );
    	if ($notification['name'] == "Web Contact"){
    		$notification['to'] = get_field('staff_email', $post_id);
    		$notification['toType'] = 'routing';
    		$notification['routing'] = array(
    			'fieldID' => 1,
    			'operator' => 'is',
    			'value' => get_field('full_name', $post_id),
    			'email' => get_field('staff_email', $post_id)
    		);
    	GFCommon::log_debug( __METHOD__ . '(): Email To => ' . print_r( $email_to, true ) );
    	GFCommon::log_debug( __METHOD__ . '(): Modified Notification => ' . print_r( $notification, true ) );
    	return $notification;
    	}
    }