Other PDF Issues

How to Create a Daily Sequential BOL Number in a PDF Form

Huma Ashraf ChHuma Ashraf Ch Nov 3, 2026 869 views

Question details

The user wants to generate a daily sequential Bill of Lading (BOL) number combining the current date (YYMMDD) and a daily sequence (e.g., -01) in a PDF form.

How to Create a Daily Sequential BOL Number in a PDF Form
Product
PDF Forms
Device & OS
not provided
Scenario
Designing a dynamic PDF form that requires unique, auto-incrementing sequential numbers for daily tracking.
Observed behavior
The user needs a reliable JavaScript solution or workflow to automatically reset the sequence to 01 each new day and increment for subsequent forms.
Before you start

Ensure you have a PDF editor that supports adding and editing document-level or button JavaScript, and be aware that local JavaScript solutions are best suited for single-user environments rather than multi-user network sharing.

Solution 1Recommended

Implement Document-Level JavaScript for Sequential Numbering

Use JavaScript to format the current date and append an incrementing sequence number, storing the last value in a hidden field.

Local PDF JavaScript cannot inherently sync across multiple users or devices simultaneously. This method is effective for a single user generating forms locally where the PDF file state is saved or handled through a trusted workflow.

1
Create Form Fields

Open your PDF form in a PDF editor. Create a visible text field named 'BOL_Number' to display the generated number, and a hidden text field named 'Last_Date' to store the tracking data.

2
Add JavaScript Code

Access the document's JavaScript editor (usually under the 'Prepare Form' or 'Form' menu). Add a script that retrieves the current date in 'YYMMDD' format.

3
Implement Reset Logic

Write logic within the script to compare the current date against the hidden 'Last_Date' field. If the date matches, increment the sequence; if it changes, reset the sequence to '01'.

4
Trigger the Script

Assign this script to a button (e.g., 'Generate BOL') or run it at the document level when the file is opened, ensuring it updates the hidden field upon execution.

Implement Document-Level JavaScript for Sequential Numbering
Multi-User Limitations: If multiple people need to generate BOLs simultaneously, you must use a server-side database process rather than local PDF JavaScript to prevent sequence conflicts.
Powerful PDF Editor

Edit and Manage PDF Forms Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to create, fill, and manage interactive PDF forms. Whether you need to add text fields, buttons, or manage document properties, WPS PDF makes it seamless.

  1. 1. Open WPS PDF: Launch WPS Office and open your PDF document using the WPS PDF tool.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all available interactive form controls.
  3. 3. Add Text Fields: Click on 'Text Field' to insert a box where your BOL number will be displayed.
  4. 4. Save and Share: After configuring your form, save the document to lock in the layout and share it with your team.
Easily add and edit text fields, buttons, and form controlsHighly compatible with standard PDF forms and Adobe Acrobat formatsLightweight, fast, and features a user-friendly tabbed interfaceCross-platform support for managing PDFs on Windows, Mac, and mobile
microsoft office alternative - wps office

Frequently Asked Questions

Can I use this JavaScript for multiple users on a shared network?

No, local PDF JavaScript cannot reliably maintain a shared sequence across multiple users or devices. If several people are creating forms simultaneously, you should use a server-side or database process to avoid duplicate BOL numbers.

How do I hide the tracking field in the PDF?

In your PDF form editor, right-click the text field you are using to store the last sequence, select Properties, and under the General tab, change the Form Field property from 'Visible' to 'Hidden'.

Will the sequence automatically reset at midnight?

The sequence resets based on the date comparison in your JavaScript. When the script runs to generate a new BOL, it checks the current date against the stored date; if they differ (which happens on a new day), it resets the sequence to 01.