Email Submission / with if/else subject - InfoPath Dev
in

InfoPath Dev

Email Submission / with if/else subject

Last post 01-10-2007 03:00 PM by Patrick Halstead. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-27-2006 02:45 PM

    Email Submission / with if/else subject

    Thank you in advance for any help. I am new to infopath and do not know very much about Jscript. This is what I have. I have a form with several fields that I would like to base my subject on when submitted.

    I do think I have an issue wih my name space...

    the fields I have are: Day, Shift, and Date

    Day is a dropdown menu with Monday - Sunday
    Shift is a drop down menu with the following...
    Display Value
    1st Shift 5AM - 12PM PST
    2nd Shift 12PM - 7PM PST
    3rd Shift 7PM - 5AM PST
    Saturday 5AM - 5AM PST
    Sunday 5AM - 5AM PST
    Holiday 5AM - 5AM PST

    And the last a date picker field formated as mm/dd/yy

    Based on the Shift and day selected I need to have the Subject of the email formated in the following standard

    Examples 1st shift weekday & a weekend or holiday
    Shift Turnover - Monday mm/dd/yy 5AM - 12PM PST
    Shift Turnover - Saturday mm/dd/yy 5AM - Sunday mm/dd/yy 5AM

    I would prefer not use managed code as I do no know how to inlcluded the form in the body of the email any aother way than I am doing now... Here is what I have so far from the MSE... I also think I might have a problem with my namespace...

    /*
    * This file contains functions for data validation and form-level events.
    * Because the functions are referenced in the form definition (.xsf) file,
    * it is recommended that you do not modify the name of the function,
    * or the name and number of arguments.
    *
    */

    // The following line is created by Microsoft Office InfoPath to define the prefixes
    // for all the known namespaces in the main XML data file.
    // Any modification to the form files made outside of InfoPath
    // will not be automatically updated.
    //<namespacesDefinition>
    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-22T21:08:17"');
    //</namespacesDefinition>





    //=======
    // 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.
    //=======
    function SubmitBtn::OnClick(eventObj)
    {
    createEmail() // Calls email function
    }

    function createEmail() //creates email
    {

    //var xmlShift = XDocument.DOM.selectSingleNode("//my:TurnOver/my:ShiftInfo/my:Shift");
    //var xmlDate = XDocument.DOM.selectSingleNode("/my:TurnOver/my:ShiftInfo/my:TodaysDate");
    //var xmlDay = XDocument.DOM.selectSingleNode("/my:TurnOver/my:ShiftInfo/my:Day");
    try
    {
    var oEnvelope = XDocument.View.Window.MailEnvelope;

    oEnvelope.To = ("[email protected];");
    oEnvelope.Subject = ("Shift Turnover - ")
    oEnvelope.Visible = true;


    }
    catch (ex)
    {
    XDocument.UI.Alert(ex.description);
    }
    }
  • 01-10-2007 01:43 AM In reply to

    Re: Email Submission / with if/else subject

    Hi Snyderjd,
    Somehow we missed this over the holidays. Sorry about that! You can use concat function to do this. In the E-mail data connector, click on the Fx button next to Subject and then click on "concat". Click on the parameters and select the fields in your form that you want to concatenate together. You may need to add a few parameters and some text like " - " between time. In addition some of the values may not format real well.
    Patrick Halstead
    Project Manager at Qdabra
  • 01-10-2007 02:01 PM In reply to

    Re: Email Submission / with if/else subject

    Thank you for the reply, I am aware of the Fx button using the email data connector, however, there is no option to include the form in the body of the email when using that method... which Is why I am tyring to solve this problem with code... can it be down with script or managed code? Can you point me in any directions? Thanks!
  • 01-10-2007 03:00 PM In reply to

    Re: Email Submission / with if/else subject

    If you are submitting the form to a DB or SharePoint, you should use a link to the form. If you have a completely e-mail based solution it's difficult to allow for form edits since people can always open up an older form by mistake. My suggestion is to not store the forms in Outlook inbox but to store them on a website or DB and use links to them in the e-mail body.

    There have been threads before on the topic of attaching the form programmatically. I seem to recall a discussion 2-3 months ago - not sure how it ended. Maybe that was you... :) Please try to search "e-mail attachment form" or something like that in the forum search (upper right). Good luck.
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.