Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

206
Vistas
How to prevent overwrite in acrobat form if it has the same file name created from form fields with automated mysaveas

UPDATED 1/5/2022: We have an adobe acrobat form in which we created a "Save to share drive" button and have the completed form save to a designated folder on a share drive and create a file name based on certain fields in the form. We added a .js file to the javascript folder in the C: program files to allow save as. All of that is working fine HOWEVER if another person comes along and completes a form and selects the same fields, then the file name could be the same. The code prompts the 2nd user to overwrite file with same name or not, but it doesn't let you execute the not overwrite function.

How can we either altogether prevent an overwrite or do a saveAs with a slightly different name like with a (2) after it? We get the pop up saying "the file XXNAME already exists, Do you want to replace it?" If you click Yes on the pop-up, it overwrites the existing file. If you click No, it doesn't overwrite, but you get this message: "NotAllowedError: Security settings prevent access to this property or method. Doc.saveAs:3:Field SaveToShareDrive:Mouse Up"

Here is the JavaScript code saved in a .js file in the program files:

mySaveAs = app.trustPropagatorFunction(function(doc,path) { app.beginPriv(); doc.saveAs({cPath: path, bPromptToOverwrite: true}); app.endPriv(); })   

myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path) { // Privileged and/or non-privileged code above app.beginPriv(); mySaveAs(doc,path); app.endPriv(); // Privileged and/or non-privileged code below });

Here is the JavaScript code on the "Save to Share Drive" button in the form itself:

// build file name
var myFileName = getField("CaseNameInRegardsTo").value + "-" + getField("Classification").value + "-" + getField("IrType").value + "-" +
getField("Initial").value + "-" + getField("SpecialRqstProgram").value + "-" + getField("SpecialRequestType").value + "-" + getField("ReportCounty").value + "-" +
getField("CompanionReports").value + "-" +
getField("SensitiveCase").value +
".pdf";
 
// add folder name
myFileName = "/S/swi/downtime/" + myFileName;
myTrustedSpecialTaskFunc(this, myFileName);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Hello Juan, I'm having an issue while running Button script. In javascript Debugger shows an error which is: ReferenceError: myTrustedSpecialTaskFunc is not defined 5:Field:Mouse Up

Is there anything missing in my javascript.

var myFileName = this.getField("bm1").value +"-" + this.getField("bm2").value +"-" + this.getField("bm3").value +"-" + this.getField("bm4").value +"-" + this.getField("bm5").value+ "-" + util.printd("dd-mm-yyyy hhmm", dt)+ ".pdf";

myFileName = "/c/test/" + myFileName

myTrustedSpecialTaskFunc(this, myFileName);

app.alert("This Form ( "+myFileName+" ) has saved successfully to the following location: /C/test/" , 3);

about 4 years ago · Sohail asif Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda