Emailing selective fields within a form - InfoPath Dev
in

InfoPath Dev

Emailing selective fields within a form

Last post 12-06-2006 08:50 AM by chuckiecc. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-04-2006 02:54 PM

    Emailing selective fields within a form

    Hi, hopefully someone can help. I have a complex infopath form with many fields (over 600). I want to parse out only a few and submit them via email with the email submission control. I can however only figure out how to submit the entire form.

    Can someone please help.. thanks.

    ps Im new at this so you will have to go a bit slow for me if you dont mind.. thanks
  • 12-05-2006 04:59 PM In reply to

    Re: Emailing selective fields within a form

    Perhaps you can create a new view that has only the fields you want to email, and then perform your email from that view.
  • 12-05-2006 05:19 PM In reply to

    Re: Emailing selective fields within a form

    Greg thanks.. yes I thought of that, but it emails the entire form. This was the subject of previous posts on other topics as well. However I understand that with code, you can only attach certain fields in 2003.. I *think* this limitation is removed in 2007.. but not sure as my copy hasnt arrived yet.. In the meantime, I did read in a post somewhere that you CAN do this with code, but no example of that code.. So I continue my search...

    thanks for the reply Greg..
  • 12-06-2006 04:39 AM In reply to

    • GazM
    • Top 200 Contributor
      Male
    • Joined on 11-09-2005
    • England
    • Posts 54

    Re: Emailing selective fields within a form

    Hi
    I had a similar problem and after hours of searching I found this code (VBScript) and modified it to suit my needs. It will send the contents of the selected fields (just 2 in this example) as the body of the email.

    '=======
    ' The following function handler is created by Microsoft Office InfoPath.
    ' Do not modify the name of the function, or the name and number of arguments.
    '=======
    Sub SendData(eventObj)
    Dim bStarted
    Dim oOutlookApp
    Dim oItem
    Dim oBody
    Dim oORacle
    Dim oTitle

    On Error Resume Next

    Set oOutlookApp = GetObject(, "Outlook.Application")
    If Err <> 0 Then
    Set oOutlookApp = CreateObject("Outlook.Application")
    bStarted = True
    End If

    Set oOracle = XDocument.DOM.selectSingleNode("//my:myFields/my:Oracle")
    Set oTitle = XDocument.DOM.selectSingleNode("//my:myFields/my:Title")
    oBody = "Oracle No:" & oOracle.text & " Scheme Title:" & oTitle.text

    Set oItem = oOutlookApp.CreateItem(olMailItem)

    With oItem
    'Set the recipient
    .To = "anyone@emailaddress"
    'Set the recipient for a copy
    '.CC = "[email protected]"
    'Set the subject
    .Subject = "7 day notice"
    'The content of the document is used as the body for the email
    .Body = oBody
    'Add the document as an attachment, you can use the .displayname property
    'to set the description that's used in the message
    '.Attachments.Add Source:=ActiveDocument.FullName, Type:=olByValue, _
    ' DisplayName:="Document as attachment"
    .Send
    End With

    If bStarted Then
    oOutlookApp.Quit
    End If

    Set oItem = Nothing
    Set oOutlookApp = Nothing
    End Sub

    Hope this helps

    Gary
  • 12-06-2006 08:50 AM In reply to

    Re: Emailing selective fields within a form

    Gary thanks.. Yes I searched for a long while.. I have not tried the code but VERY much appreciate your submission.

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