St John Customer Central · HHSJ-UAT · checked 10-Nov-26

Who makes each file

Three systems draw the files customers receive. Which one draws a file depends on the document and on whether the org is running in FSR or FIS mode. UAT today: FSR mode, Schedule print switch on, both document engine types active.

Colour shows the system: Salesforce Business Central, through AIS FIS, through Mule Reaches the customer Outside trigger
FileFSR mode (UAT today)FIS mode
1 · Schedule PDF Salesforce draws itDynamic Document engine, right after the order is saved Not madeThe FIS invoice carries its own schedule section
2 · Invoice PDF Business Central draws itSalesforce receives the finished PDF, files it and emails it FIS draws itSalesforce receives the finished PDF, files it and emails it
3 · Certificate Salesforce draws itSFReg decides, the Dynamic Document engine renders FIS draws itSalesforce only asks FIS to print
1

Schedule PDF

Drawn by SalesforceFSR mode only

The list of what was bought and who is booked. Salesforce makes it in a background job a moment after the order is saved, files it on the Order and attaches it to the purchase summary email.

ORDER ARRIVES SALESFORCE JOB WHO DRAWS THE PDF FILE DELIVERY Website orderMy StJohn, POST /v2/orders Order Quick CreateCSC staff, internal form Offline renewalmembership payment run Schedule jobOrderSchedulePdfQueueableruns after the order saves FSR mode + print switch on FIS mode, or switch off Document engineDynamicSchedulePDF Legacy pageOrderSchedulePDF if the engine fails No Schedule PDFsummary email still goes File on the OrderSchedule-….pdfA4 portrait Summary emailto the purchaser,PDF attached
Every step is inside Salesforce. Three channels queue the same job; the mode and the print switch decide whether a PDF is drawn at all.

Schematic, sample data. Header numbers, products before training, one card per course with its attendees, GST-inclusive total, delivery panel.

Started by
A new order from the website (real inbound REST calls only), from Order Quick Create, or from an offline membership renewal. Mid-term Up/Downgrade orders and Telecare orders do not start it.
Drawn by
Salesforce. DynamicScheduleService renders page DynamicSchedulePDF from template Schedule_Standard. If the engine cannot produce it, the legacy page OrderSchedulePDF renders in a second hop.
Switches
FSR mode (OrderAPIOutbound on) and OrderSchedulePrint on. Either one off means no PDF.
File
Schedule-<customerNo>_<orderNo>.pdf, filed on the Order.
Delivery
Attached to the purchase summary email (template OrderConfirmation, from info@). Private Ambulance Membership and website downgrade orders get the file on the Order but no email (QA and UAT since 09-Nov-26).
Seen in UAT
Last 20 days: Schedule files filed by the My StJohn integration user (website) and by CSC users (Order Quick Create).
2

Invoice PDF

FSR: Business CentralFIS: FIS

Salesforce never draws an invoice. The finance system draws it and posts the finished PDF back. Salesforce names it, files it on the Order and emails it. Credit notes and donation receipts come in through the same door.

TRIGGER WHO DRAWS THE PDF HOW IT REACHES SALESFORCE SALESFORCE RESULT FSR MODE FIS MODE Order submittedin Salesforce via AIS via Mule Business Centraldraws the invoice PDF FISdraws the invoice PDF PDF PDF Financial document APIPOST api/v2/financialDocumentas API IntegrationUser Notification APIPOST /v1/notificationsas My StJohn Notificationfiles the PDF,sends the email File on the Ordername differs by mode Invoice emailto the customer
The two modes differ in who draws the PDF and which API it arrives on. From Notification onwards the path is the same.

Schematic, sample data. The layout and wording belong to the finance system, so Salesforce cannot change what the invoice says.

Started by
The order going to finance. FSR: cc.salesorder.create through AIS. FIS: the order event through Mule.
Drawn by
FSR: Business Central (the PDF's own metadata says "Sales Invoice", producer Aspose.Words). FIS: FIS.
Arrives
FSR: POST api/v2/financialDocument → flow SF_Inbound_FinancialDoc_API_Handler → FinancialDocumentAPIHandler → NotificationRestResource (type OrderInvoice). FIS: Mule posts to /v1/notifications as the My StJohn user.
File
FSR: OrderInvoice_<orderNo>_Combined_<PS invoiceNo>.pdf. FIS: Invoice_<invoiceNo>_Combined_<ref>.PDF. Both on the Order.
Delivery
Invoice email to the customer from Notification. In FSR, FinancialDocumentBillingLinkJob also links the file to the Billing Transaction.
Same door
Credit notes (CreditNote_…) and donation receipts (DonationRcpt_…).
Seen in UAT
Last 20 days: OrderInvoice_…PS… files filed by API IntegrationUser. FIS-mode days (21 to 29-Oct): Invoice_3530… files filed by My StJohn.
3

Certificate

FSR: SalesforceFIS: FIS

Starts when the tutor marks an attendee competent. The booking moves to Certificate Requested (CR), and the mode decides who prints. Either way the PDF ends up filed on the booking and emailed to the attendee.

TRIGGER SALESFORCE API REQUEST WHO DRAWS THE PDF FILE DELIVERY FSR MODE FIS MODE Marked competenttutor, Training Portal Booking set to CRPUT …/contactAssetRolesthen checks the mode SFReg requestNZQA or standard? Document engineDynamicCertificatePDF File on bookingstatus CR → CS Attendee emailcertificate attached Order event to FISPRINT_CERTIFICATE FIS, through Muleprints and returns it File on bookingCR → CP → CS Attendee emailfrom training@ SFDocs indexDocuments portal
One switch, read at the moment the booking reaches CR, sends the request down the Salesforce row or the FIS row. Both rows file a Cert_ PDF on the booking, which SFDocs then indexes.

Schematic, sample data. A4 landscape. Each slot is filled from the certificate template chosen for the product.

Started by
Tutor marks the attendee competent in the Training Portal or Moodle, which calls PUT /v1/contactAssetRoles with status CR. The daily CertificateRequestBatch and the Generate Certificate link use the same request service.
FSR route
SFReg_CertificateRequestService → SFReg_CertificateEntitlement (NZQA, standard, or hold) → SFReg_CertificateIssueQueueable, five bookings per hop → DynamicCertificateService → page DynamicCertificatePDF.
FIS route
Order event PRINT_CERTIFICATE (flow Publish_FIS_Update_Details) → Mule → FIS prints → file and email come back through My StJohn. Took 27 to 61 minutes in UAT.
File
Salesforce: Cert_<First>_<Last>_<bookingNo>_<yyyyMMdd>.pdf, with _NZQA before the date on NZQA certificates. FIS: Cert_<First>_<Last>_<no>_<no>.PDF. Both on the booking (ContactAssetRole__c).
Delivery
FSR: post-course email (EMAIL_POST_COURSE_CERT) with the file attached, then CR → CS. FIS: template AttendeeCertificate from training@, CR → CP → CS.
Where live
Mode-following behaviour is in UAT since 29-Oct-26 and QA since 09-Nov-26.
3a

Inside Salesforce: how the certificate is made

FSR mode

Two parts with a hard line between them. SFReg decides who gets which certificate, sends the email and marks the booking as sent. The Dynamic Document engine only draws the PDF and files it.

WHO ASKS SFREG: DECIDES, EMAILS, MARKS AS SENT DYNAMIC DOCUMENT ENGINE: DRAWS AND FILES Marked competentby the tutor Daily retry batchbookings still at CR Request doorsingle entry point Entitlement ruleNZQA, standardor not ready entitled Issue job5 bookings per hop not ready Held at Chold Case for CSC released, or closed at 8 weeks NZQA or standard Template recordwords, colours, 3 images Resolveproduct rule → template RenderDynamicCertificatePDF StoreFile on the booking new File Attendee emailPDF attached Mark as sentCR → CS
Every request enters one door: the tutor's completion, the daily retry, and a held booking coming back. Only the issue job talks to the engine, and it renders before it writes anything, because Salesforce will not draw a PDF after unsaved changes in the same transaction.

Schematic, sample data. Layout Landscape_Classic. Wording, colours and images are edited in the Dynamic Document Manager, with no deployment.

#PartComes from
1BackgroundTemplate image File
2LogoTemplate image File
3HeadingTemplate Heading_Text__c
4Attendee nameBooking Service_Recipient__c, else the Contact name, else the Lead name
5Completion textTemplate Completion_Text__c
6CourseThe Asset name on the booking
7NZQA creditsTemplate Credits_Text__c; it can pull the product's own rule with {rule:NAME}
8Date, valid untilService_Start_Date__c; Service_End_Date__c, else completion plus the template's validity years
9SignatureTemplate image File, signatory name and title
10FooterTemplate Footer_Text__c
11Training IDBooking ExternalCode__c
StepWhat happensWhere in the codeUAT today
1 Ask Every request enters one door. A booking whose certificate was already sent is answered "already sent" and set back to CS, so a certificate is issued once. SFReg_CertificateRequestService.requestBulk Mode setting certificateGenerationMode__c = Salesforce
2 Decide No NZQA add-on on the product, or NZQA declined: standard. NZQA wanted, registration finished, NSN present and verified: NZQA. NZQA wanted but any of those missing: not ready. SFReg_CertificateEntitlement
3 Hold A not-ready booking is parked at C and a hold Case is raised for CSC. It is released when the attendee finishes. At eight weeks the closure batch opts them out of NZQA and a standard certificate goes. SFReg_PostCourseCertGate, SFReg_CertHoldCaseService, SFReg_PostCourseCertClosureBatch Hold gate on; closure after 8 weeks
4 Queue One background job for all entitled bookings, five per hop. The next hop is queued first, because filing a certificate uses the job's only spare queue slot. SFReg_CertificateIssueQueueable
5 Resolve The engine reads the product's rule, CERTIFICATE_NZQA or CERTIFICATE_NON_NZQA, folded Family → Offer → Variant → Option. The rule names the template. No rule or no template means nothing is drawn and an error is logged. DynamicCertificateService, DynamicDocumentService, DynamicDocumentRuleResolver Templates Certificate_NZQA_Dyn and Certificate_Non_NZQA_Dyn, both active, validity 2 years
6 Render The page is drawn as a PDF, A4 landscape. The controller fills the tokens (attendee, course, dates, training ID, certificate number) into the template's wording and places the three images. DynamicDocumentPageRenderer, page DynamicCertificatePDF, DynamicCertificatePdfController, DynamicDocumentImageService Document type Certificate active
7 Store The PDF is saved as a File on the booking. The number in the name is the booking's own number. SFDocs sees the new File and indexes it for the Documents portal. DynamicDocumentFileStore Last 30 days: 35 engine-made certificate files, 5 with the _NZQA marker
8 Deliver The booking is locked and re-checked, then the post-course email goes with the File attached. The NZQA Credit add-on is set to match and the booking moves CR → CS. If the email fails the booking stays at CR and the daily batch retries. RegistrationEmailService.dispatchCertificate (EMAIL_POST_COURSE_CERT, or EMAIL_AUTO_OPT_OUT_CERT after a closure)

Two edge cases. An attendee with no email address, or who has opted out, still gets the File on the booking and moves to CS with no email. A retry draws a new File each time, so a booking whose email failed can carry more than one.

4

Everything else we generate

Found by reading every PDF page and every Apex class that creates a file or an email attachment in the UAT export of 09-Nov-26.

FileFormatStarted byDrawn byComponentsWhere it lands
Credit notePDF Finance issues a credit Business Central FIS Same route as the invoice, type CreditNote File on the Order, email to the customer, Documents portal
Donation receiptPDF A donation on an order Business Central FIS Same route as the invoice; file DonationRcpt_… File on the Order, email, Documents portal
Membership letterPDF CSC clicks Print/Download Letter on a membershipAcknowledge, Renewal, Lapsed, Downgraded Order, Purchase Summary Salesforce printLetterModal → AM_PrintLetterController → page AM_PrintLetter Downloads in the browser; filed on the Order as <Type> Letter - <recipient>.pdf; a Task is logged
Mail-house lettersDATA Scheduled letter run, or the Campaign Letter Builder Mail house MailHouseBatchable writes Letter__c rows from Letter_Type__c No file in Salesforce. The mail house reads the rows and prints the letter
Supplier purchase orderPDF An order with unshipped supplier-fulfilled items is processed Salesforce OrderController.send_PO_PDF_ToSupplier → page PO_PDF → Notification SupplierPO Emailed to the supplier; address and file name from Vendor_details__mdt
Group billing pro forma invoicePDF Group billing run, scheduled or manual Salesforce RVGroupBillingService → RVGroupBillingInvoicePdfGenerator → page RvGroupBillingProformaInvoice File <Bill-to> (<acct>) <Month> pro forma invoice.pdf
Group billing remittanceCSV Same group billing run Salesforce RVGroupBillingService Email attachment … <Month> Remittance.csv
NZQA reportTXT Staff run the NZQA report Salesforce NZQAReportController → NZQAReportCreatorBatchexception, final and NSN validation reports Saved as a File and emailed
Medical alarms activation listCSV Telecare report job Salesforce ReportRetriever → TelecareReportEmailManager Emailed to managers
Data check reportsCSV Scheduled job Salesforce ReportScriptSchedule → ReportScriptJobsQueuable Emailed: bookings with no certificate file, orders with an invoice number but no PDF
Documents portal ZIPZIP Customer or CSC ticks documents and chooses Download as ZIP The browser docsDocumentList, docsAccountDocuments with JSZip Download only. Nothing new is stored
Quote PDFPDF Standard Salesforce quote PDF Salesforce Flow ContentDocument_AfterSave_QuotePDF_StartSync reacts when one is savedNot traced further today File on the Quote

After the file exists

What the Documents portal picks up

SFDocs watches new files and indexes one when its name starts with cert_, invoice_, creditnote_ or donationrcpt_. UAT holds 3,781 invoices, 389 training certificates, 354 donation receipts and 172 credit notes in the portal index.

Schedule PDFs and membership letters have no matching prefix, so they stay on the Order only.

Found today: FSR invoices never reach the portal

Business Central invoices are filed as OrderInvoice_…. That does not start with invoice_, so SFDocs skips them.

  • UAT, last 14 days: 5,549 OrderInvoice_ files filed, 0 portal invoices with a PS number.
  • All 37 invoices indexed in that window are FIS ones, from the days UAT ran in FIS mode.
  • Certificates are fine in both modes: both names start with Cert_.

Other open points on these routes

  • Mid-term Up/Downgrade orders never queue the Schedule job, so they get no Schedule PDF.
  • In FIS mode a certificate request is dropped when the order has no invoice yet, and nothing retries it.
  • The FSR invoice says "Payment due by" on orders already paid. The wording is Business Central's, so the fix sits there.