Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

133
Views
PDF SaveAS Filename From Data With JS Customization

I seached and found a script that works for saving as from data in specific fields and managed to customize it to a degree to work for my application. It saves to the current folder when launched from a action button and pulls the info from the fields as it should without issue.

Here's the script for reference:

/* saveAS */

    // determine the directory path for the current document 
    var directory = "";
this.path.substring(0, this.path.lastIndexOf('/') +1); 
    if (typeof(mySaveAs) == "function") { 
      mySaveAs(this, directory, "W.O." + " " + this.getField("W.O. #").value + " " + this.getField("Work Site Address").value + " " + this.getField("Date").value + ".pdf"); 
    } else { 
      app.alert("Missing Save Function. Please contact forms administrator "); 
    } 

What I need help with is changing the date format it uses in the file name. For example; the date in the date field is fomated as mmmm d, yyyy (displays date as October 23, 2021) which is how I would like it to display there. When running the script it should change and use the date as mmm d, yyyy (display date as Oct 23, 2021 in the filename). I am pretty sure this can be done as I have used something similar to this for other code before and it worked, but the code syntax was a bit different.

Another thing I would like if possible would be to have it change the formatting for the filename specifically how it puts the jobsite address field into the file name. We usually put the full address in that field in this format "street_# street_name street_type. city, province" When using the script to save as the file, I want it to only use it like this: "steet_# street_name street_type." basically it should ignore everything in the address field after the period when creating the filename. Is it possible to write something like this?

The final filename should look like this: "W.O. 7655 123 First St. Oct 23, 2021.pdf" when saved as with the above formatting changes applied.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!