Thank you very much for your reply.
I have done the following to modify the script:
- Changed the script in the last section from "this" to "d[i]"
In mailDoc changed the "bUI to true"
Page open event added the script "this.disclosed = true;"
- Added {} brackets after the activeDocs if statement.
This modified script works when tested in the console.
However it does not work from the button in the original form.
The script will bring the "Request for Tender" form to the front, but it does not generate an email or close the file.
Can you please advise why it will work from the console but not from the button?
Many thanks, look forward to your reply. Have included the modified script as follows:
var p = this.getField("PackageName");
var v = this.getField("VendorName");
var d = app.activeDocs;
for (var i = 0; i < d.length; i++)
if (d[i].documentFileName == "Request for Tender " + p.value + v.value + ".pdf") {
d[i].bringToFront();
d[i].mailDoc({
bUI: true,
cTo: "",
cCC: "",
cSubject: "Request for Tender " + p.value + " " + v.value,
cMsg: "Please find attached request for tender." + "\n" + "\n" + "Please fill in and return"
});
d[i].closeDoc(true);
}