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

Save As - Not Allowed Security Error

Level 3
Level 3


I have a script to save a livecycle form with a predefined path and file name.

However there is a Not allowed Error: Security settings prevent access to this property or method.

I am not sure why the security error is still there when a trusted function is used.

Can someone please provide some assistance with the script to advise where it could be going wrong?


= app.trustPropagatorFunction(function(doc,path)







= app.trustedFunction(function(doc,path)


// Privileged and/or non-privileged code above





// Privileged and/or non-privileged code below



this, "/c/temp/Leave Application" + Applicants_Name.rawValue + ".pdf");

Any help will be greatly appreciated.

6 Replies
Level 1
Level 1'Donovan

Hello Jo,

I have a referred to a Post by Niall O'Donovan in a Prior Post similar to yours,

see if this resolves your Issue.


You don't need this trusted function. It allows a form to access properties such as the login name, etc.

// folder level JavaScript to allow access to the identity object properties

trustedIdentity = app.trustedFunction( function (sProperty)


var iProperty = "";


iProperty = identity[sProperty];


return iProperty;


The script in the .js accessing the fields in the form are not correct:

var vDate1 =[0].Page1[0].Date1[0]).rawValue.toString();

var vTime1 =[0].Page1[0].Time1[0]).rawValue.toString();

Firstly the main page in the form is not named, which makes referencing it difficult. If you call the page "page1", then remember that javascript is case sensitive.It should look something like this:

var vDate1 =[0].page1[0].Date1[0]).rawValue.toString();

var vTime1 =[0].page1[0].Time1[0]).rawValue.toString();

You will need to create a "Test" folder in the root directory "C:", as Acrobat will not create one for you.

Lastly it will not work in Reader unless the form is Reader Enabled.



Level 3
Level 3

Thank you for your reply.

I have removed the trusted function from script and referenced the field in a variable.

var myDoc =;

var appname =[0].Page1[0].Applicants_Name[0]).rawValue.toString();


myDoc.saveAs("/c/forms/Template/Leave Application "

+ appname + ".pdf");

I now have a  an error for the field as follows:

topmostSubform[0] has no properties
3:XFA:topmostSubform[0]:Page1[0]:Applicants_Name[0]:exitException in line 3 of function top_level, script XFA:topmostSubform[0]:Page1[0]:Applicants_Name[0]:exit

topmostSubform[0] has no properties

Also a security access error due to trusted function being removed:

NotAllowedError: Security settings prevent access to this property or method.

Can you please suggest amendments to the script?

Thank you very much for your assistance.

Level 3
Level 3

Hello Reena,

I have modifed the script and it is now working.

I have placed the following script into the javascript folder:

var mySaveDoc = app.trustedFunction(function(doc) {

var myPath = app.getPath("user", "documents") + "/" + "Leave Application" + " " + empname + ".pdf";

    // saveAs is the only privileged code that needs to be enclosed
    // with beginPriv/endPriv


The following script is placed in the exit event of the livecycle form field:

empname = xfa.resolveNode("xfa.form.topmostSubform[0].Page1[0].Applicants_Name[0]").rawValue;

Thank you for your help.

Level 5
Level 5


I realize it's been a while since this was posted.....I can't get this to work.

I know where to put the code for the exit event, no problem there.  Where exactly do you put the first portion of the script that you mentioned you put in the javascript folder?