MailEnvelope error - InfoPath Dev
in

InfoPath Dev

MailEnvelope error

Last post 03-18-2007 10:25 AM by cvinfo1. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-15-2007 06:59 AM

    MailEnvelope error

    Hello,

    I don't know enough about scripting to resolve this so please help. When I click on my Create Email button. I get this error:
    The following error occurred:

    InfoPath has encountered an error. The operation failed.
    The form's code contains an error.

    The following call in the form's code failed: MailEnvelope.To
    File:script.js
    Line:44

    This is the code I have for this:
    function CTRL37_5::OnClick(eventObj)
    {
    // Write your code here
    var oEnvelope = XDocument.View.Window.MailEnvelope;
    oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" +
    XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text;
    oEnvelope.Subject = "PHS EDI File Confirmation - " +
    XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text;
    oEnvelope.Visible = true;
    }
    Is the code wrong?

    Any help would be greatly appreciated.

    Thanks!!
  • 03-15-2007 07:21 AM In reply to

    try Application.ActiveWindow.MailEnvelope;
    instead of your XDocument.View.......
    Listen to Motörhead cos they play Rock'n Roll :)
  • 03-16-2007 07:06 AM In reply to

    Thank you nukkumatti. So this may be a dumb question but like I said I don't know much about this. Would I need to change all references to XDocument.View to Application.ActiveWindow...? The reason I ask is I made that change and then it prompted the error on the next line (oEnvelope.To...), see below.

    The following error occurred:

    InfoPath has encountered an error. The operation failed.
    The form's code contains an error.

    The following call in the form's code failed: MailEnvelope.To
    File:script.js
    Line:47

    function CTRL37_5::OnClick(eventObj) { // Write your code here try Application.ActiveWindow.MailEnvelope; //instead of your XDocument.View.......
    //var oEnvelope = XDocument.View.Window.MailEnvelope;
    var oEnvelope = Application.ActiveWindow.MailEnvelope;
    oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" + XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text;
    oEnvelope.Subject = "PHS EDI File Confirmation - " + XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text; oEnvelope.Visible = true; }

    Thanks!
  • 03-18-2007 10:25 AM In reply to

    Can anyone help me here please?

    This the code I have after the recommendation by nukkumatti, below. I get the same error "InfoPath has encountered an error. The operation failed.The form's code contains an error. The following call in the form's code failed: MailEnvelope.To
    File:script.js
    Line:44"

    Code...
    {
    var oEnvelope = Application.ActiveWindow.MailEnvelope;
    oEnvelope.To = XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail").text + ";" +
    XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupEmail2").text;
    oEnvelope.Subject = "PHS EDI File Confirmation - " +
    XDocument.DOM.selectSingleNode("my:ConfirmFilesForm/my:GroupName").text;
    oEnvelope.Visible = true;
    }
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.