Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Need help in livecycle designer using automated javascript sending emails

Avatar

Level 1

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});

2 Replies

Avatar

Level 1

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

Level 5

Brian,

Glad you found a solution.

Thanks for posting it - it really does help others.

Best Regards

Mark