Advice needed: Advanced Document Lifecycle Workflow (Approval -> Edit -> Publish -> Archive + Log)

**!! I edited this post 3 times since I felt I had clarify a few things

Hi everyone,**

I am looking for advice on setting up a strict Change Control workflow for a medical device company (following MDR/ISO 13485 regulations). We need to manage PDF documentation used by our sales team.

The Context:

  • Source: InDesign/Affinity (managed offline/internally).

  • Output: PDFs (distributed via Nextcloud).

  • Apps: Flow, Approval, Workflow Script (planned).

  • Feedback Mechanism: We plan to use Nextcloud’s native comments (sidebar), as our sales reps only have “Read” access to the files and cannot annotate the PDF directly.

The Required Workflow (Double Approval):

We need a process that separates the decision to change from the approval of the result.

  1. Change Request (The Trigger):

    • A user (Sales Rep) finds an error in a published PDF.

    • They tag the file (e.g., Change Request) and add a description of the error in the Nextcloud comments sidebar.

  2. Assessment (Approval Step 1):

    • The Regulatory Affairs Manager receives a notification.

    • They review the comment/request to decide if the change should be made.

    • Action: If approved, the file gets a new tag (e.g., Approved for Edit) and Marketing is notified.

  3. Execution (Offline & Upload):

    • Marketing fixes the source file (InDesign) and exports a New PDF.

    • The New PDF is uploaded to a “Drafts” folder.

  4. Verification (Approval Step 2):

    • The Regulatory Affairs Manager reviews the New PDF.

    • Action: If approved, the automated publication starts.

  5. Publication & Logging (The Automation):

    • Swap: The New PDF replaces the Old PDF in the shared folder (preserving the filename/link is preferred).

    • Archive: The Old PDF is moved to an “Obsolete” folder.

    • MDR Log: A script appends a line to a master ChangeLog.csv with: Date, Filename, Requested By, Approved By, Comment content.

My specific questions:

  1. Linking the chain: Since Step 1 happens on the Old File (where the comment is) and Step 4 happens on the New File, what is the best strategy to keep the “ticket information” intact across this gap?

  2. File Replacement Strategy: Has anyone successfully scripted a “Replace and Archive” flow that maintains the original public link/file ID?

  3. Logging: Can the Workflow Script app easily fetch the latest comment from a file to write it into the external log?

Any ideas on how to orchestrate this “Sandwiched” approval process (Approval → Work → Approval) in Nextcloud would be invaluable.