For @Arslan786 , and everyone who experiences something similar
Update Zatca Reference Error

ZATCA Invoice Fix Guide - Manual Form Modification
Make sure to back up your Business Data before trying it.
Overview
This guide helps you manually modify invoice forms when automatic processing fails, by temporarily disabling form validation scripts and updating ZATCA-related fields.
Step 1: Disable Form Validation Scripts
Modify CustomField Descriptions
You need to modify the following CustomFields:
- Approval Status
- Base64 QRCode
- Zatca UUID
- Zatca Certificate Info
For each CustomField:
- Go to Settings → Custom Fields
- Find and Edit the CustomField
- Locate the Description field
- Find the script tag that starts with:
<script> document.addEventListener('DOMContentLoaded', () => - Add “xxx” at the beginning to disable it:
<script>xxx document.addEventListener('DOMContentLoaded', () => - Save the changes
Purpose: This prevents the form locking script from running, allowing you to modify and save the form manually.
Step 2: Extract Values from Success Report
- Download the ZIP file generated after successful reporting/clearance
- Open the TXT file inside the ZIP archive
- Copy the following values from the TXT file:
ApprovalStatusZatcaUUIDBase64QrCodeICVvalue (for Last ICV)InvoiceHashvalue (for Last PIH)
Step 3: Update Business Details
- Go to Settings → Business Details
- Edit the business details
- Update the following fields:
- Last ICV: Enter the
ICV:value from the TXT file - Last PIH: Enter the
InvoiceHash:value from the TXT file
- Last ICV: Enter the
- Save the changes
Step 4: Update Failed Invoice
- Open/Edit the invoice that failed processing
- Manually fill the following fields with values from the TXT file:
- Approval Status: Enter the
ApprovalStatusvalue - Zatca UUID: Enter the
ZatcaUUIDvalue - Base64 QRCode: Enter the
Base64QrCodevalue
- Approval Status: Enter the
- Save the invoice
Step 5: Re-enable Form Validation Scripts
Restore CustomField Descriptions
- Go back to Settings → Custom Fields
- Edit each of the four CustomFields again:
- Approval Status
- Base64 QRCode
- Zatca UUID
- Zatca Certificate Info
- Remove the “xxx” from the script tags:
Should become:<script>xxx document.addEventListener('DOMContentLoaded', () =><script> document.addEventListener('DOMContentLoaded', () => - Save all changes
Important Notes
- This process temporarily disables form validation to allow manual data entry
- Always re-enable the scripts after completing the manual updates
- Keep the TXT file from successful reports as reference for future manual fixes
- This method should only be used when automatic ZATCA processing fails
Troubleshooting
- If you can’t save the form, ensure all validation scripts are properly disabled (step 1)
- Double-check that values copied from TXT file are complete and accurate
- Verify that Last ICV and Last PIH are updated in Business Details before processing new invoices