Need help in livecycle designer using automated javascript sending emails

Avatar

Avatar

brian_s_blanton

Avatar

brian_s_blanton

brian_s_blanton

12-01-2017

I am trying to modify a form to add a button that takes values from fields that will be populated by the user and then send an email using these fields

currently I have the following script:

var vTo = ""

var vCC= xfa.resolveNode("RequestorEmail").rawValue;

var vSubject = "Purchase Request #: " + xfa.resolveNode("OfficeSymbol1").rawValue + xfa.resolveNode("PurchaseRequest").rawValue + " --> " + xfa.resolveNode("PriorityDesignator").rawValue;

var vBody = "Purchase Request #: " + xfa.resolveNode("OfficeSymbol1").rawValue + xfa.resolveNode("PurchaseRequest").rawValue + " / " + xfa.resolveNode("PriorityDesignator").rawValue + "\nThis PR has been submitted to your manager\n" + xfa.resolveNode("Justification").rawValue + "\n" + xfa.resolveNode("SpecialInstructions").rawValue + "\n" + "The date the requestor is needing the items by " + xfa.resolveNode("DateNeeded").rawValue;

event.target.app.mailDOC({bUI: true, cTo: vTo, cCc: vCC, cSubject: vSubject, cMsg: vBody});

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar

brian_s_blanton

Avatar

brian_s_blanton

brian_s_blanton

13-01-2017

I have resolved my own question see my code below.

var mail;

var vTo = ""

var vCC = xfa.resolveNode("RequestorEmail").rawValue;

var vSubject = "Purchase Request #: " + xfa.resolveNode("OfficeSymbol1").rawValue + xfa.resolveNode("PurchaseRequest").rawValue + " --> " + xfa.resolveNode("PriorityDesignator").rawValue;

var vBody = "Purchase Request #: " + xfa.resolveNode("OfficeSymbol1").rawValue + xfa.resolveNode("PurchaseRequest").rawValue + " / " + xfa.resolveNode("PriorityDesignator").rawValue + "\nThis PR has been submitted to your manager\n" + xfa.resolveNode("Justification").rawValue + "\n" + xfa.resolveNode("SpecialInstructions").rawValue + "\n" + "The date the requestor is needing the items by " + xfa.resolveNode("DateNeeded").rawValue;

mail = "mailto:" + "?cc=" + vCC + "&subject=" + vSubject + "&body=" + vBody;

event.target.submitForm({cURL: mail, bEmpty: true, cSubmitAs: "PDF", cCharset: "utf-8"});

this code allows me to do what  I need. I thought I would share its format with everyone incase someone else was needing something similar.

Avatar

Avatar

Mark_Lindberg

Avatar

Mark_Lindberg

Mark_Lindberg

17-01-2017

Brian,

Glad you found a solution.

Thanks for posting it - it really does help others.

Best Regards

Mark