Save and email when a submit button clicked? Please help - InfoPath Dev
in

InfoPath Dev

Save and email when a submit button clicked? Please help

Last post 05-18-2010 09:31 AM by anatemple. 10 replies.
Page 1 of 1 (11 items)
Sort Posts: Previous Next
  • 06-16-2009 02:14 PM

    Save and email when a submit button clicked? Please help

    I have a submit button and i would like to have two thing accomplised when the button is clicked. Save the save and email the notification to the users. I have a web service which will sending the email but right after the click is click and before the email is send, i would like to save the form data first (xml file) buy proving a save as dialog and the save the file to the template directory. I don't know how to display the save as dialog using codes inside  FormEvents_Submit, can someone help?

    thank you

  • 06-16-2009 06:26 PM In reply to

    Re: Save and email when a submit button clicked? Please help

    This blog post on custom code in the save event will help you see how to display the save as dialog.

    Actually, this may be even more helpful, so try it first...
    Hilary Stoupa

  • 06-16-2009 08:57 PM In reply to

    Re: Save and email when a submit button clicked? Please help

    do you really have to do all that?  Do you need a web service just to send an email, and do you actually have to prompt users with the Save/SaveAs prompt?  Wouldn't you rather pre-define the filename based off metadata in the form, ensure your formula results in a unique filename, auto-submit to the form library, then automatically kick off the email without any web service?

    Are you required to go through the headaches you described, or are you allowed to use the much more efficient, built-in features of InfoPath to accomplish the same thing?

  • 06-16-2009 11:52 PM In reply to

    Re: Save and email when a submit button clicked? Please help

    As usual, Clayton has excellent architectural advice. You don't need a Web Service to submit an InfoPath form via e-mail. You don't even need any code and using meta-data in your form to set the filename is also a good idea if you don't have access to SharePoint library IDs or SQL row IDs. Keep it simple!

    Patrick Halstead
    Project Manager at Qdabra
  • 06-17-2009 06:35 AM In reply to

    Re: Save and email when a submit button clicked? Please help

     Hi warrtalon: 

    "Wouldn't you rather pre-define the filename based off metadata in the form, ensure your formula results in a unique filename, auto-submit to the form library, then automatically kick off the email ". How do i go about doing all of that? Rules or codes? Can you point me to some direction?

    The reason i need to use web service to send email because i need to do a few things for the email: frist, Get the current logged-on user id and from there i query for user name (first, and last name) and email address from the database using the userid. second, formulate a custom email body with html format as requested by the customer and third, read a predefined list of users from web.config file who will receive the email notification .

    Anyone has a better suggestion?

  • 06-17-2009 06:41 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    Again, you don't need a web service or a database for that unless you're just referring to SharePoint's built-in UserProfileService.  Is that what you're talking about?  That still isn't part of the email submit - it's a separate step.  You can get the user id by simply using the function "userName()," then you send this username to the GetProfileByName web method to retrieve email address, first name, last name, and whatever else.  You can then submit to email through InfoPath using any of this info...all through rules with no code, no database, and no custom web services.

    Why would a web.config have a list of users?  You aren't using a basic SharePoint list with users?

    The body of the email truly has to have HTML in it instead of just structured data from the form, or the form itself in a custom view?  I'm really confused by all these requirements that are a ton of work but could very VERY easily be done with basic InfoPath and SharePoint constructs.  We are talking about browser forms, so SharePoint has to be in play.

    Writing up the entire solution for you is a lot of work, but maybe my blog entries can help show you some things:

    Auto-Numbering InfoPath Forms (for this one, check step 4 after Figure 10 for the Edit/Submit part)

    User Roles in Browser-Enabled Forms (look at all of this)

  • 06-17-2009 08:58 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    Hi warrtalon

    I don't have much experience with infopath and sharepoint to start with. I created an web application in asp.net for the customer and one of the requirements is to create 5 data entry forms for the users. I was asked to use infopath since the users like the way the form is viewed. So i started to created 5 brower-compatible infopath forms and webservice methods to query data for some of the dropdown list boxes within those forms. Those formed worked correctly and the form saving part is done automatically. As a new requirement, i have to provide the user the ability to save the form as well as sending email notification to the group of default recipients as well as the choosen list that the user picked from the drop down list in side those forms. To take care of the "default recipient group", i added their email addresses to the web.config file of the my web service project and i read them from there. For the choosen list of recipients i allow the user to choose only one addtional email from the list (because of browser infopath form restriction). I intended to take care of the new requirement by adding  a Submit button that allows the user to save the form, sending the email notification (i can live with text only for now)  and close the form in one shot (one click). That is where this post is started. I did not know that you can submit form and send email using Rules.

    The sharepoint server was setup by someone else who is no longer with the company. There were no list of any kind available in sharepoint server sites

    A short while ago, i was just trying to add a Web Reference to VSTA's project under FormEvents_Loading method so i can use UserProfileService but the Add Reference button is disabled after adding the URL of the web service text box. so i can't use it and don't quite know why the Add Reference button is disabled.

    I will look at the two links that provided above. thank you

  • 06-17-2009 09:41 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    So you have both SharePoint and a custom web application built in ASP.NET?  You are using the browser-enabled forms in SharePoint (leveraging MOSS Enterprise Forms Services), and are making calls to that other custom web app that's not in SharePoint?  Is that all correct?

    Well, if you don't know SharePoint nor InfoPath well, then it's not so easy to just explain it all.  This is a full solution, and it requires gaining much knowledge about how SharePoint works, how InfoPath works, how they work together, and how to avoid just about everything you've done so far outside of those constructs.

  • 06-17-2009 10:39 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    yes i am using browser-enabled forms in SharePoint leveraging MOSS Form services. Currently all my form are working correctly without the custom save and send email feature and that is where i am at. i am learning infopath and sharepoint at the same time. Here is i think i need for my submit button click:

    1. Create 1st rule to save the file into document library. When creating a data connection to submit the data "To a document library on a SharePoint Site". I am a bit confuse of what is the right path for the Document library. For example the link below is one of the document library for my form, should i use http://myserver/sites/MySite/Manage%20Schedule%20Times%20in%20ROE/ or should i use the whole string?

    http://myserver/sites/MySite/Manage%20Schedule%20Times%20in%20ROE/Forms/AllItems.aspx

    2. Create 2nd rule to email notification to the users.

    3. Create 3rd rule to close the form.

    From my previous post, when trying to add the web service for the UserPreferenceService, the Add Reference button is disable and therefore i can't not use that service, do you have any reason as to why It is disabled?

  • 06-17-2009 10:54 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    Yes, those 3 rules should be very easy and are correct.

    1) Just the library link, but if you do the entire URL with the view name, it will cut that part off after you publish anyway, so don't worry about it.

    2) Yes, and this can either be the email submit function of InfoPath that sends the current view of the form within the email, or you can do your own workflow that generates an email.  I do this easily with SharePoint Designer, so it should be easy with VS.  Using the built-in submit to email is probably the easiest by far as long as you're ok with the view.  You could ultimately create an email-specific view that looks very nice and is only for the workflow email part (not for usage within the form).

    3) Super easy action with no strings attached.

    I don't know what you mean by add reference.  I never use such a thing.  I simply go to Tools > Manage Data Connections > Add data connection.  From there, I add the UserProfileService and go to town.  There should be no code required for any of this and thus no need to built the form in VS.

    Oh, did my blog entries help at all, or did you figure it out from other help?  I just started the blog, so I'm trying to see if it's of any value.  It's a ton of work (I never realized and have a higher appreciation for others), so I want to make sure it's worth continuing and adding to.  Thanks!

  • 05-18-2010 09:31 AM In reply to

    Re: Save and email when a submit button clicked? Please help

    I've been trying to get my Infopath Submit to Email data connection to work in the browser.  I could use your help.  When submitted from a browser IE just states "An error occurred while the form was being submitted" if it is an email address external to our domain.  If it is an internal email it works fine.  How can I get this to send to an external user?  (In short, the InfoPath client will submit to an internal and external email address.  The browser will only submit to an internal email address.)

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