PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

"Catch All" Notifications Routing

  1. Hi All,

    I imagine I'm not the first to ask this question but I can't find it anywhere else on the forums, so here goes!

    We have a client who wishes to send notifications to a certain email address depending on which country is selected in a dropdown. That's all well and good and is easily done I know, the thing is the client insists that every country in the world be included in the dropdown. Furthermore, only about 4 countries have a specified email address and the rest will go to a "catch all" address.

    We would rather not spend the time adding this email address into every country in the world, but rather specify the 4 countries as required and if none of those rules are met, have gravity forms send the notification to the "catch all" address.

    Is this possible natively or do we have to write some php?

    Posted 12 years ago on Tuesday April 17, 2012 | Permalink
  2. David Peralty

    As you probably already can tell, the only way to do it natively would be to set an address for each country using routing. You'll definitely have to write some php to accomplish what you are looking for to create a routing list the way you mentioned.

    Posted 12 years ago on Tuesday April 17, 2012 | Permalink
  3. Hi David,

    Thanks for your reply. Writing PHP is no problem, we've implemented the below.

    function filter_gform_country( $form )
    {
    	$_routing[ 'canada' ] = 'emailhere';
    	$key = strtolower( $_POST[ 'input_13' ] );
    
    	if( array_key_exists( $key, $_routing ) )
    		$form[ 'notification' ][ 'to' ] = $_routing[ $key ];
    
    	return $form;
    }
    add_filter( 'gform_pre_submission_filter', 'filter_gform_country' );

    Is there a way we can make this a feature request? It would be nice if the client could manage routing with a "catch all" themselves, rather than needing to have us modify the filter each and every time.

    Posted 12 years ago on Wednesday April 18, 2012 | Permalink
  4. David Peralty

    We constantly look at our http://www.gravityhelp.com/forums/forum/feature-requests section for the most important features to implement. Please feel free to add this request and I'll get the developers to look it over.

    Posted 12 years ago on Wednesday April 18, 2012 | Permalink