Form submit (sharepoint & email) - InfoPath Dev
in

InfoPath Dev

Now you can find InfoPathDev on YouTube and Twitter!
Find Qdabra on Facebook

Form submit (sharepoint & email)

Last post 01-27-2010 10:43 PM by AM2010. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 01-27-2010 12:17 AM

    Form submit (sharepoint & email)

    I'm using InfoPath 2007 and MOSS 2007 to setup a forms portal.  We're looking to provide form templates (running in InfoPath Forms Services within the browser) that the user can submit directly to a sharepoint library and also have the filled out form sent to them via email.

    So far I've established I need to have two data connections on my form, one to submit to Sharepoint and one to send the email. I also want to set a property before I submit the form so that I can identify the form has been submitted in Sharepoint and not send out another email if it is saved/submitted again.  I've got this set up with a custom button and several rules (I'm not using the built-in submit and save functionality).  The logic is as follows:

    If the "submitted" property is False, set the property to True, email the form and submit it to Sharepoint.  If the "submitted" property is already True, submit the form to Sharepoint and close.

    I've got a few issues with this at the moment.

    1 - I'm using field validation for mandatory fields.  If a validation error occurs, it happens when InfoPath tries to submit the form.  By this point I've already set the "submitted" property to true and so when the user corrects the errors and submits the form again, it doesn't send the email.  I don't want to write code behind the form to validate manually as we intend to produce several hundred forms and writing the same code for each one isn't workable.

    2 - One possibility I can think of is sending the email first then submitting to sharepoint, so that any properties can be set between these two actions.  However if there are any problems submitting the form to sharepoint I don't want to send the email, but I don't think this is a possibility from what I've seen so far.  Once the email has been sent, it can't be recalled regardless of whether the submit to SharePoint fails.  Does anyone have any ideas about how we can avoid this situation where an email is sent but the form isn't submitted?

     Thanks for your help

  • 01-27-2010 02:49 AM In reply to

    Re: Form submit (sharepoint & email)

    try doin this

    if the submitted property is true,

    -) send the form via mail

    -) submit to sharepoint

    -) set submitted to true

    all of this in only one rule. that should do it

    Qazi Anis
    Programmer Analyst
    Bitwise Solutions
    my blog
  • 01-27-2010 03:01 AM In reply to

    Re: Form submit (sharepoint & email)

    Did you mean "if the submitted property is false," at the start of your post?

    Also I should've mentioned I've tried setting the property after the form is submitted to sharepoint but that didn't seem to work. 

    From what I understood, the property was being set after the file was saved to the sharepoint form library.  This meant the property was still false in the copy in sharepoint (unless I saved it to sharepoint again after the property had been set).  When I open the submitted form directly from sharepoint, the property is still false so it thinks the form hasn't been submitted yet.

    Does that make sense or do you think I may have set this up incorrectly?


  • 01-27-2010 06:50 AM In reply to

    Re: Form submit (sharepoint & email)

    oh sorry for the typo,

    take two flags say submitted and submit_2

    if the submitted property is false

    -) send the form via mail

    -) set submitted to true

    -) submit to sharepoint

    the data validations will fire on submittion via mail if any

    Qazi Anis
    Programmer Analyst
    Bitwise Solutions
    my blog
  • 01-27-2010 07:45 AM In reply to

    Re: Form submit (sharepoint & email)

    Thanks for the info. I can see how that would work and it sounds very similar to the way I proposed in the original post i.e. 

    AM2010:
    One possibility I can think of is sending the email first then submitting to sharepoint, so that any properties can be set between these two actions. 

    My issue with doing it this way is that if there is any problem/error with the Sharepoint site or form library, I could end up in a situation where the email is sent but the form is not saved to Sharepoint.  Whilst this may not be a big problem in functional terms as the email is still there for users, it is an issue for audit and traceability purposes as the submitted form has to be in sharepoint for future reference. 

    The users of my application will primarily be interested in the email confirmation of the submission and it is only administrators that will be looking at submitted forms via sharepoint. I understand that there could just as easily be errors with the SMTP server and the email may never get delivered to the users, but in this instance the user would be aware there had been a problem as they would know they hadn't received an email, which wouldn't be the case if it failed to save to Sharepoint.

    I'm a newbie to MOSS and InfoPath so I'm a little cautious about how stable sharepoint will be and how reliable the submission mechanism actually is in a production environment where there may be hundreds of submissions within a single day.  I guess this may be an issue I'll have to learn to live with. I just wondered whether anyone had stumbled across a similar issue before and if there were any proposals for getting around this.

    Thanks again for the tips.

  • 01-27-2010 10:12 PM In reply to

    Re: Form submit (sharepoint & email)

    to be double sure follow this sequence

    -) submit to sharepoint

    -) set the flags

    -) send mail

    -) submit to sharepoint again

    Qazi Anis
    Programmer Analyst
    Bitwise Solutions
    my blog
  • 01-27-2010 10:43 PM In reply to

    Re: Form submit (sharepoint & email)

    Yep that would be another option. I'd previously tried this in my environment and it worked pretty well. Each option has its advantages and disadvantages though and for this option the disadvantage is that the Sharepoint site would have to deal with double the number of form submissions, so I'm not sure its the best option for scalability. The forms solution we're building could have several hundred form submissions a day and if you have two submits to Sharepoint for each form submission that's a significant factor. Thanks for your help though, you've given me plenty to think about for now!
Page 1 of 1 (7 items)
Copyright © 2003-2010 Qdabra Software. All rights reserved.
View our Terms of Use.