3 Replies Latest reply on Jan 26, 2012 12:27 PM by Srini Dhulipalla

    Filtering Duplicate Email Addresses

    cpruitt32

      I created a form using LiveCycle Designer, the first and hopefully only form I'll ever have to create.  I am in no way, shape, or form a programmer.  These forums are the only way I was able to put together a functional form.  So now to the question at hand....

       

      I have two dropdown boxes:  Division & Program

      Each selection in both dropdown boxes has an email address assigned to it.

      Then I have a submit event that sends an email which addresses to the Program and CCs the Division.

       

      "mailto:" + Program.rawValue + "?cc=" + Division.rawValue + "&subject=Email Subject"

       

      This works fine.  However, occasionally the Program email address and Division email address are the same.  Is there a way I can forego the cc only when the address is already present in the mailto line?

       

      Any advice is greatly appreciated!

       

        • 1. Re: Filtering Duplicate Email Addresses
          Srini Dhulipalla Level 5

          You can try the following..

           

          if(Program.rawValue == Division.rawValue)

               "mailto:" + Program.rawValue + "?subject=Email Subject";

          else

               "mailto:" + Program.rawValue + "?cc=" + Division.rawValue + "&subject=Email Subject";

           

          Thanks

          Srini

          • 2. Re: Filtering Duplicate Email Addresses
            cpruitt32 Level 1

            Thanks for the reply Srini.  I tried entering that in a few different spots in the script but I can't seem to make it work.  Here's the the entire event script, maybe this will be more helpful than the one line I entered in my original post.

             

            if (Program.rawValue != null) {

              RealEmailButton.event__click.submit.target= "mailto:" + Program.rawValue + "?cc=" + Division.rawValue + "&subject=Email Subject"

                //app.alert(RealEmailButton.event__click.submit.target);

              RealEmailButton.execEvent ("click");

            } else {

              app.alert ("Alert Message")

            }

            • 3. Re: Filtering Duplicate Email Addresses
              Srini Dhulipalla Level 5

              Do the following.

              1) Place a button control on the form and change the Control Type to Submit.

              2) Copy the below code and paste it in the preSubmit event of the button.

              3) You do not need to call the click event. So I commented it out.

               

              if (Program.rawValue != null) {

                  var strEmail = "";

               

                   if(Program.rawValue == Division.rawValue){

                        strEmail = "mailto:" + Program.rawValue + "?subject=Email Subject";

                   }

                   else{

                        strEmail = "mailto:" + Program.rawValue + "?cc=" + Division.rawValue + "&subject=Email Subject";

                   }

               

                   if(strEmail != "")

                        RealEmailButton.event__click.submit.target = strEmail;

                   else

                        app.alert ("Problem while sending the email.")    

               

                    //app.alert(RealEmailButton.event__click.submit.target);

                  //RealEmailButton.execEvent ("click");

              } else {

                app.alert ("Alert Message")

              }

               

               

              Thanks

              Srini