specify email recipients based on what options are selected from a multiple list box - InfoPath Dev
in

InfoPath Dev

specify email recipients based on what options are selected from a multiple list box

Last post 10-29-2015 11:16 AM by rutica. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 09-17-2015 01:07 PM

    specify email recipients based on what options are selected from a multiple list box

    Hi,

    I’m using Windows 7 and Internet Explorer 11 and InfoPath 2010.

    I have an InfoPath form in Sharepoint inside an InfoPath Form Web part. The Info Path form contains a multiple selection list box. I would like the form to be emailed to different people depending on what is selected from the multiple selection list box.

    For example, let’s say my list box has choices of: fruit; veggies and candy

    If someone selects fruit and clicks Submit, the form will be emailed to Fred.

    If someone selects veggies and clicks Submit, the form will be emailed to Veronica.

    If someone selects candy and clicks Submit, the form will be emailed to Cory.

    If someone selects fruit and veggies and clicks Submit, the form will be emailed to Fred and Veronica.

    If someone selects fruit and veggies and candy and clicks Submit, the form will be emailed to Fred, Veronica and Cory.

    Etc.

    I know how to email the form to a generic mailbox, but how do you specify recipients based on what options are selected from the multiple list box?

    Thanks

  • 09-17-2015 02:46 PM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

    Just add a field called "To" - it can be to your main data source or to a an XML secondary data source if you like. Then add rules to set that field - set up your Submit data connection to use the field for your "To" in the data connection (you can click the fx button and select the field). Hope that makes sense?
    Hilary Stoupa

  • 10-07-2015 10:00 AM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

    Hilary:

    Thanks so much for your reply! I think I understand everything you said but I'm not sure how to do step 2 (or 3):

    1). in InfoPath Designer, create a text box called txtTo

    2). add rules to set the new txtTo field to be the value I want (separated by commas?)

    3). hide txtTo so it's not visible on the form. (is invisibility a property available for a text box?)

    4). using the Data Connection Wizard, assign the txtTo field for the "To" field for the email.

     Thanks again! 

  • 10-07-2015 10:19 AM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

     You can just delete the text box control from the form view - the data will still be stored in the form's data source. If you need multiple addresses, I think generally they are separated by semicolons.

    As to setting the value of txtTo - usually I just handle that on my Submit rules - if some condition is met, set txtTo to one value, if another condition is met, set it to some other value. For testing, put txtTo on your form so you can see what it is getting set to. :) 

    Hilary Stoupa

  • 10-07-2015 11:11 AM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

     Hilary,

    Thanks so much for the quick reply. I'm new to InfoPath so I'm still confused.

    I have a multi selection list box called mlstDocType with a data type of Text (String). For list box choices, I selected 'enter choices manually' and entered 6 choices.

    I created a submit button. I click on the button and on the Data tab at the top menu bar go to Submit Options... it has 'perform custom action using rules'. I click Cancel. Then I click on Form Submit. I have an action rule called Rule 1: 'Submit using a data connection'. The rule details is to send an email.

     Should I add rules to Rule 1? I see there is a rule called 'set a field's value'.  I chose Field: txtTo, but what do I put for Value? Do I write an If statement? Something like: If mlstDocType="fruit", then txtTo="Fred", if mlstDocType = "veggies", then txtTo="Veronica" , etc?

     

    Thanks so much for your help! 

  • 10-07-2015 01:23 PM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

     I got a little further...

    I went to Form Submit and added 6 new action rules (Rule 2 thru Rule 7) to run under my existing Rule 1.  (I added 6 rules since I have 6 options for my multiple selection list box). I moved my Rule 1 (Email form) to the bottom so it will trigger last.

    Rule 2: For Condition, I put: 'select a field or group' and found my mlstDocType. I said 'is equal to' and selected 'type text' and typed "Fruit". Under 'run these actions' I choose 'set a field's value'.  For field, I entered txtTo. For Value, I put [email protected];

    Rule 3: For Condition, I put: 'select a field or group' and found my mlstDocType. I said 'is equal to' and selected 'type text' and typed "Veggies". Under 'run these actions' I choose 'set a field's value'.  For field, I entered txtTo. For Value, I put [email protected];

    ...and so on for my 6 options for my multiple selection list box.

     But it doesn't concatenate my string in txtTo. For example, if I check both Fruit and Veggies, it only gives me [email protected] (I want it to give me both names: [email protected]; [email protected])

     Thanks! 

      

  • 10-07-2015 02:19 PM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

    Rename your rules so they are easy to make sense of later. :-) A rule to set a field's value will just set the value - so you are probably getting whatever rule runs last. You could always change the action, where you set a field's value, to concat in the existing value - like set txtTo to concat(txtTo, ";[email protected]"). Does that make sense?
    Hilary Stoupa

  • 10-14-2015 07:30 AM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

     Hilary: thank you so much. this works perfectly. you are so smart! :-)

     

     

     

  • 10-29-2015 11:16 AM In reply to

    Re: specify email recipients based on what options are selected from a multiple list box

    Do you think I could use Workflows to accomplish this as well? I'm not familiar with Workflows... but could it let me set up emails that are sent depending on the choices selected? Then could I also track who the action is assigned to, create reports and assign a status (open, closed, etc).

     

    The InfoPath form I created is for users to request help with different categories. We want to track the requests. 

     

    Thanks! 

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.