What is the value of saveAsFile?
Remove the line var myForm = event.target;
saveAsFile is a string that is supposed to be the filename.
var saveAsFile = "/c/output/" + getField("LastName").value + ".pdf";
saveAsFile is ok (app.alert shows me what I expect it to be). I got rid of that line and still get
NotAllowedError: Security settings prevent access to this property or method.
The security settings in Adobe is set to "No Security"
mySaveAs = app.trustedFunction(function(myForm, path)
The security error is often a misnomer. I've seen this message popup when functions fail because of other reasons.
Did you remove the line of code Bernd suggested? this is an important one.
Are you sure that "myForm" is a document object?
Do you know that "path" is a Safe Path? and that it exists?
Can you do the same save operation from the Console Window, without getting the error message?
It's not a good idea to have a variable called "path" because there's a built-in property of the Document object with that name. Try using something else.
I put the "trusted function" in a js file under the user folder, as opposed to the app folder and now it is behaving as expected.
That's ridiculous. I can guarantee you the location of the trusted function is not the issue. Are you sure it wasn't the "path" variable that try pointed out?
I would suggest that you move it to the App folder and see if the issue persists. Make sure its in only one of the two locations.