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.

Help with conditional routing

  1. DysX631
    Member

    Hi guys,

    I asked about conditional routing before here; http://www.gravityhelp.com/forums/topic/conditional-routing

    I've since purchased the form and basically I have a selection of checkboxes (over 30 in total) and I am trying to get this code to work with just 3 checkboxes for now.

    add_filter("gform_pre_submission_filter", "add_bcc");
    function add_bcc($form){
    
        //creating list of emails based on fields on the form
        $bcc  = $_POST["input_31.1"] . "storea1@domain.com,storea2@domain.com"; //Store A
        $bcc .= $_POST["input_31.9"] . "storeb1@domain.com,storeb2@domain.com"; //Store B
        $bcc .= $_POST["input_31.15"] . "storea3@domain.com,storec1@domain.com"; //Store C
    
        //setting notification BCC field to the list of fields
        $form["notification"]["bcc"] = $bcc;
    
        //returning modified form object
        return $form;
    
    }

    So basically I want if some picks Store A & Store B from the checkboxes the notification goes to storea1@domain.com, storea2@domain.com, storeb1@domain.com, and storeb2@domain.com.

    Alternatively if someone only picks Store A it'll go to storea1@domain.com and storea2@domain.com

    Right now it's going to all 6 email address regardless of selection plus the email specified in the admin area. Can you help please?

    Thanks!

    Posted 13 years ago on Friday October 21, 2011 | Permalink
  2. It sounds like you want two notifications sent for each store, address 1 and address 2? And you're using checkboxes, so there could be up to 60 notifications sent, 2 for each store, for each of 30 check boxes.

    Check out this code I wrote to see if it helps you:
    http://pastebin.com/Nyyigyxb

    Please post if you have questions implementing it. This will add BCC email addresses to the admin notification. The notification will still be set up in your form builder. There will still be a "To:" notification sent, to the address you set up in the form builder. There are a few things you will need to modify to make this work in your situation.

    Posted 13 years ago on Saturday October 22, 2011 | Permalink
  3. DysX631
    Member

    Hi Chris,

    Thanks so much for that, worked perfectly. Really appreciate it! :)

    Posted 13 years ago on Sunday October 23, 2011 | Permalink
  4. Great. Glad that worked out. It was fun to create.

    Posted 13 years ago on Monday October 24, 2011 | Permalink

This topic has been resolved and has been closed to new replies.