Script that modifies the sourceSet model or its children makes the form’s certification invalid and the form can no longer be trusted. Because a form can become certified at any time during its life cycle, it is important to use scripting techniques that prevent the form from failing after it is certified.
You must work with clones of the model rather than with the model if you intend to use scripts that modify the sourceSet model or any of its children. Cloning prevents the form from failing when scripts modify a data model. For example, forms that execute common tasks, such as displaying records in a database or selecting specific records in a database, require the modification of data connection nodes contained within the sourceSet model.
To clone the sourceSet model, you must create a method on the script that defines the data connection that you want to modify within the sourceSet model and make sure that the script keeps using the clone instead of the definition.
var oDB = xfa.sourceSet.nodes.item(nIndex).clone(1);

Working around security restrictions