So let's say I have a submit button that I want to send a workflow email, how can I have it send the email once the submit button is clicked in infopath?
2 Answers
If your submit button operates in the standard manner (i.e. submitting saves the form to the library or list) then you would simply need to change the start up behavior of the workflow.
Open the workflow in SharePoint Designer and under "Start Options' on the workflow's home page, remove the check from "Start workflow manually...". Be sure the check either "Start on create..." or "Start on change...". In your case I think you would use "Start on create...".
If you're submitting your InfoPath form to a Form Library, create a workflow attached to this list (form library) and set workflow action to start automatically when an item is added/modified depending on your situation.
Chooose Email action to send emails.
If you want your form to be state aware and send different emails depending on state, create a hidden (state) ineger on form, increase its value on each submit and perform conditional checks on this state variable from your workflow before sending different emails.
You can also keep the same file name across multiple submits of the same form.