Email coding error - InfoPath Dev
in

InfoPath Dev

Email coding error

Last post 09-07-2006 11:22 AM by Matt Faus. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-06-2006 06:02 PM

    Email coding error


    This is my first jscript coding and I cannot get past my first typed line code. I'm doing a email submit and I get an error message below.

    The following error occurred:

    Expected ';'
    File:script.js
    Line:59
    Var sEmailTo = XDocument.DOM.selectSingleNode("//my:myfields/my:hiring_mgr_email");


    Here are the entire codes.

    function CTRL13_10::OnClick(eventObj)
    {
    Var sEmailTo=XDocument.DOM.selectSingleNode("//my:myfields/my:hiring_mgr_email");
    Var sSubject = "MIS request for new hire - ".concat.XDocument.DOM.selectSingleNode("//my:myfields/my:employee_name").concat." - Completed";
    Var sTelExt = XDocument.DOM.selectSingleNode("//my:myfields/my:telephone_ext");
    Var sTelDirect = XDocument.DOM.selectSingleNode("//my:myfields/my:telephone_direct");
    Var sFaxDirect = XDocument.DOM.selectSingleNode("//my:myfields/my:direct_fax");
    Var sFaxDept = XDocument.DOM.selectSingleNode("//my:myfields/my:dept_fax_number");
    Var sEmailAddress = XDocument.DOM.selectSingleNode("//my:myfields/my:email_address");
    Var sCtrlLf = chr(13) & chr(10);
    Var sEmailText = "Here are the following MIS request items:"
    Var sEmailTextFinal = sEmailText.concat.sCtrlLf.concat."Telephone:".concat.sCtrlLf.concat." Ext - ".concat.sTelExt.sCtrlLf."Direct Line - ".concat.sTelDirect;

    Var oEmail = XDocument.DataAdapters("eMail");
    oEmail.To = sEmailTo;
    oEmail.Subject = sSubject;
    oEmail.Intro = sEmailTextFinal;
    o.Email.Submit();

    -----------------------------------------------------------------
    Here's the output I want:

    [Subject] MIS request for new hire - Joe Doe - completed
    [Email Introduction] <space>
    Here are the following MIS request items:
    Telehone:
    Ext - 5342
    Direct - (000)555-5342
    <space>
    Fax:
    Dept - (000) 555-1234
    Direct - (000) 555-5678


  • 09-06-2006 06:03 PM In reply to

    I changed myfields to myFields and I still get the same error.
  • 09-06-2006 11:50 PM In reply to

    Hi,

    I am really not a JScript guy but from the error message you posted I would suggest that you jump to your code line 59 and check if you are not missing a ";" behind one of your statements.
    Also take care with you xpaths i think they are case sensitive but am not sure, may be someone can confirm this ?

    Hope this helps
    Listen to Motörhead cos they play Rock'n Roll :)
  • 09-07-2006 08:57 AM In reply to

    There's ';' at the end. It's so frustrating so please anyone help.
  • 09-07-2006 11:22 AM In reply to

    I don't do VB much, but this line just doesn't look right:

    Var sSubject = "MIS request for new hire - ".concat.XDocument.DOM.selectSingleNode("//my:myfields/my:employee_name").concat." - Completed";

    Maybe it should be something like this:

    Var sSubject = "MIS request for new hire - " + XDocument.DOM.selectSingleNode("//my:myfields/my:employee_name").text + " - Completed";
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.