Squeeze for Dynamics 365 BC - en-US Manual for the administration and use of SQUEEZE for Microsoft Dynamics 365 Business Central. SQUEEZE is a multi-client software solution for document classification and Content extraction. It is a fully web-based system for processing electronic documents, with a significant focus on the recognition and extraction of incoming documents in the B2B sector. System Requirements System requirements for using SQUEEZE for Dynamics 365 BC Supported Microsoft Dynamics 365 Business Central versions Microsoft Dynamics 365 Business Central integration is possible from the following version due to minimum technical requirements: Supportet Microsoft Dynamics 365 Business Central Versions The prerequisite for operation is that the respective Microsoft Dynamics 365 Business Central version is still in regular support. The extended support is excluded.   Supported SQUEEZE versions The integration of SQUEEZE in Microsoft Dynamics 365 Business Central requires a licensed SQUEEZE system from version 2.10.0 for operation. Installation Licenses Microsoft Information about the Microsoft Business Central licenses. SQUEEZE The DEXPRO SQUEEZE system that should be connected to Business Central requires a valid customer license. Obtaining the DEXPRO module Detailed Information are here. OnPrem For OnPrem installations, an runtime package with the required apps is provided upon request of a registered reseller / partner. These modules are added to the customer license by the partner and then imported into Microsoft Dynamics Business Central. It should be noted that the DEXPRO Core module forms the basis for all DEXPRO modules and must therefore be imported first. Cloud For cloud installations, you only need the Microsoft AppSource. This is where the required DEXPRO modules are downloaded. Setup Wizard When the SQUEEZE setup is opened for the first time, you will be greeted by the SQUEEZE setup wizard. This assisted-setup wizard guides the user step by step through the basic settings of the module. After completing the wizard, a connection between Microsoft Dynamics 365 Business Central and your SQUEEZE tenant is established. The wizard consists of four steps. Step 1 - Welcome The first step welcomes you and explains what the wizard does. Please have the URL to your SQUEEZE tenant API (e.g. https://yourtenantname.squeeze.one) ready before you continue. Click "Next" to start. Step 2 - Enter the tenant URL In this step you enter the URL to your SQUEEZE tenant. This is a mandatory field. Example: https://yourtenantname.squeeze.one Step 3 - Test connection & configure document classes When you proceed from the previous step, the wizard tests the connection to your SQUEEZE tenant. Once the connection has been established successfully, you can set up the document classes you want to use directly in this step. The Document Class Setup is embedded here: choose a Document Class, drill down on the Document Class ID, select the correct ID, and then continue to the next step. Step 4 - Choose number series In this step you choose the number series for your Core documents and your SQUEEZE documents. You can use the default number series the wizard created for you, or select your own. Both number series must be set before the wizard can be finished. Conclusion By clicking on "Finish" you end the setup wizard. You are then offered the option to open the Document Class Setups to continue configuring your document classes. Afterwards the SQUEEZE setup is available, where further configuration options are described here. Configuration & Administration Permission sets In order to use the modules, the appropriate authorization set must be assigned to the respective users. The following are supplied with: DXP Core Admin - DEXPRO Core Administrator DXP Core User - DEXPRO Core User DEXPRO SQUEEZE Admin - DEXPRO SQUEEZE Administrator DEXPRO SQUEEZE User - DEXPRO SQUEEZE User DEXPRO SQUEEZE Objects - Exec - a building block permission set that grants blanket execute (X) permission on all SQUEEZE objects. This set is Internal and not assignable; it is not meant to be assigned to users directly but is included by the other SQUEEZE permission sets. DEXPRO Core The DEXPRO Core manages the individual DEXPRO apps and their documents per client. All documents that have been entered and processed via the various DEXPRO modules in Microsoft Dynamics 365 Business Central are displayed. A global number series, which is used across all DEXPRO apps, is used to track individual documents. This offers the advantage that users only have to work with one number series per document. Further information can be found here. SQUEEZE Setup In the SQUEEZE setup, both the connection to the SQUEEZE system and the processing within the app are set up. Menu Home Setup Wizard This is used to start the setup wizard. This guides the user step by step through all menu items. Get API key This function is used to set the API key for the configured API name from the connected SQUEEZE system. Create jobs The automated retrieval and processing of documents from SQUEEZE requires the setup of background jobs. This can be done via this function, which creates the Document Download Job and the Cleanup Job. Copy setup This copies the setup to other clients. Master data Initially Upload master data Via the function "Upload master data for the first time" all accounts payable and accounts payable bank accounts are transferred to SQUEEZE for the first time. Navigation SQUEEZE links Using the SQUEEZE links menu item, you can see which vendor/vendor bank account has which ID on the squeeze page. User specific setup This menu item is used to access the user-specific setup. In this, different rules can be stored for each user. Import queue entries This menu displays a list of SQUEEZE vouchers that are ready to be imported into the SQUEEZE for BC app. By changing the system filter it is also possible to view already imported vouchers. Vendor related setup Via this menu item you reach the vendor-related setup. In this, deviating rules can be deposited per creditor. Document classes setup Via this menu item you reach the setup for the SQUEEZE document classes. Squeeze Master Data Tables Opens up an overview over all squeeze master data tables which were synchonisized. Fasttabs General In this Fasttab you can activate/deactivate the use of this app. Additionally you can see the version of the connected SQUEEZE system. API In this Fasttab the URL of the SQUEEZE system is specified. Furthermore, an API name is set and the corresponding API key is entered via the "Get API key" function. API Key Name: The name of the API key on the connected SQUEEZE system. The matching API key value is then retrieved for this name via the "Get API key" function. When you change the URL, Business Central logs in to the SQUEEZE system at the new URL; the Login window opens for this. If the new URL belongs to another SQUEEZE tenant, Business Central then asks whether to delete the unprocessed import queue entries that were downloaded from the previous tenant: All unprocessed import queue entries downloaded from tenant … will be deleted. Press no to abort. Yes deletes these entries. The new SQUEEZE system does not know their documents; they would fail on every run and hold up other documents. No cancels the URL change with the message Process aborted. The setup stays with the previous SQUEEZE system. If the new URL leads to the same SQUEEZE tenant, for example the same system under another address, the entries are kept and no question is asked. No. Series The number series for the SQUEEZE covers is indicated here. Background jobs The automated retrieval, processing and cleanup of documents from SQUEEZE is handled by two separate recurring job queue entries. Each is referenced by its own GUID in the SQUEEZE setup and points to a dedicated codeunit. Both job queue entries are created automatically when the setup wizard is completed (or via the "Create jobs" function). Document Download Job: Runs codeunit DXP SQUEEZE Download Tasks to retrieve and process documents from SQUEEZE. It is scheduled as a recurring job with a default frequency of every 2 minutes and is created with status On Hold so that you can review the setup before activating document processing. Set its status to Ready to start the automated download. The referencing GUID is stored in the Document Download field of the setup. Cleanup Job: Runs codeunit DXP SQUEEZE Cleanup Tasks to remove documents that have been marked for deletion. It is created with status Ready and honours the Cleanup Interval (Date Formula) configured in the Job Settings (see below), e.g. -1M. The referencing GUID is stored in the Cleanup Job field of the setup. Master Data Synchronisation: Runs codeunit DXP SQZ Synch. Master Data every 5 minutes to upload released and invoiced purchase orders to SQUEEZE (see Squeeze Master Data Tables). It is only created when orders are synchronized, appears as DEXPRO SQUEEZE - Master Data Synchronisation in the job queue entries and is not referenced in the setup. Note: Earlier versions used a single codeunit 70954640 "DXP SQUEEZE Scheduled Tasks" for this purpose. That codeunit is now obsolete (ObsoleteState = Pending) and is no longer used. The current model uses the two separate job queue entries described above. Job queue entries Two entries are created in the job queue entries: one running codeunit "DXP SQUEEZE Download Tasks" (Document Download Job) and one running codeunit "DXP SQUEEZE Cleanup Tasks" (Cleanup Job). If orders are synchronized with SQUEEZE, a third entry runs codeunit "DXP SQZ Synch. Master Data" (Master Data Synchronisation). Security This FastTab contains security-related settings: Use Document Token: When enabled, a per-document access token is used instead of the API key in viewer URLs. The token is valid for 30 minutes and is automatically refreshed. This increases security because the API key is not transmitted in browser URLs. Viewer This FastTab contains settings for the SQUEEZE Viewer: Use new Viewer: When enabled, the new SQUEEZE Viewer is used to display the scanned documents. Viewer in Target Document: When enabled, the SQUEEZE Viewer is displayed as a FactBox in the resulting target documents, e.g. in Purchase Invoices and Purchase Orders. This allows users to view the originally scanned document at any time after validation without having to navigate back to the SQUEEZE document. Job Settings In addition to the background jobs themselves, the following value can be configured in the job settings: Cleanup Interval (Date Formula): Defines how old the documents marked for deletion must be before they are cleaned up. Example: -1M means documents must be at least one month old. Document Classes Setup In the SQUEEZE document class setup, the mapping between the respective document class and your export interface is done. Furthermore, the field mapping of each document class is downloaded here, creating a set of standard fields and their usage in Microsoft Dynamics 365 Business Central. The document class setup is cross-app and is managed via the DEXPRO Core. Home Download field mapping This downloads the field structure of the SQUEEZE document class. These are needed for the metadata mapping. Navigation Field Mapping You can access the field mapping via this menu item. This defines which fields from the squeeze endpoint are transferred to the defined fields in Microsoft Dynamics 365 Business Central. The standard field mapping cannot be edited. Different mappings can be realized via the custom field mapping. Vendor Related Setup Via this menu item you reach the vendor-related setup. In this, deviating rules can be deposited per creditor. List Document classes This overview lists all the document classes that have been set up.   Card Document class Here, each document class is set up individually. General In this fastab the name of the document class, the next process step, as well as the automatic enrichment of the positions is set up. Squeeze Autocomplete: The system can remember per vendor how you assigned the lines of a document (type, no., unit of measure, description and dimensions) and fill in the same lines on the next documents. There are three options that can be selected for this. Never: The feature is switched off. The "Autocomplete" action is hidden on the validation page and nothing is filled in on import. Manual: The lines are remembered on validation. They are only applied when you run the "Autocomplete" action on the validation page. Automatic: The lines are remembered on validation and applied automatically when a document without an order no. is imported. The "Autocomplete" action is available as well. You can deviate for individual vendors in the Vendor Related Setup. Prerequisites, how it works and examples: see Autocomplete. Automatic validation: Enable this option to have Squeeze for BC automatically validate incoming receipts. Please note that this function works only in case of perfectly plausible data. Deactivate validation dialog: When a validation is completed, Squeeze for BC asks: Validation succeeded. Do you want to open the document now? Enable this switch if this question is not to be asked for documents of this document class. The setting is the default for all users. For a user with a User specific setup, its setting Deactivate Validation Dialog applies instead. In a newly created user specific setup, Deactivate Validation Dialog is already enabled. Users with a user specific setup therefore only see the question if they disable the switch there. Download attachments: Enable this switch to automatically download SQUEEZE attachments when creating a new document. Transfer attachments to target document: Here you can set whether the SQUEEZE attachments are to be transferred to the target document. Account assignment code: Specifies the account assignment setup to be used when performing the account assignment in the validation process. API Settings At this point, the ID of the connected squeeze client corresponding to the document class is stored, as well as the ID of the pull export interface and the correct line table ID. The default values do not necessarily match the setup in the squeeze client and should be cross-checked. Order Match The purchase order reconciliation is used for the automated check of the read out positions with those of the still open purchase orders in Microsoft Dynamics 365 Business Central. In this Fasttab, the permissible amount & quantity tolerances for the matching are set up. Additionally, it can be defined whether the matching should take place on purchase orders or deliveries. If "Replace data" is active, the unit price and line amount of the order line replace those of the line (for a receipt also the unit price and product posting groups of the receipt line); otherwise the unit price is only taken over if it is 0. Invoices and credit memos always take over the description, quantity and line discount % of the order line. With the Use Description 2 in Order Match switch, the automatic match also compares the recognized line description with the Description 2 of the order and receipt lines, and with their Description and Description 2 combined. The Description of the order or receipt line is still compared first; lines without a Description 2 are unaffected. Plausibility Check Here you can deactivate individual plausibility checks. The four amount checks belong together: Disable Amounts Check turns all four off at once, and switching it off turns all four on again. Below it, each one can be switched on and off on its own: Disable Header Check – net amounts and tax amounts of the header against the total amount of the header. Disable Line Comparision – net amounts of the header against the sum of the line amounts. Disable Header Tax Check – tax amounts of the header against the tax rates of the header. Disable Gross Amount Check – sum of the Amount Including VAT of the lines against the total amount of the header. The first two and the gross amount check measure against the payment tolerance of the General Ledger Setup (Payment Tolerance % and Max. Payment Tolerance Amount); the header tax check measures against Max. VAT Difference Allowed. Differences In the Differences section you set up that SQUEEZE settles a small difference between the net amounts of the header and the sum of the line amounts itself, instead of leaving the document behind over a few cents. Difference Account: the G/L account the difference is booked to. SQUEEZE adds an extra document line with this account and the difference. Leave the field empty to go on reporting every difference. Max. Difference Amount: how large the difference may be for it to be settled. It is an amount in the currency of the document, so 0.01 allows a difference of one cent. A larger difference is reported as before. At 0, nothing is settled. The line is kept up to date on every plausibility check and removed again as soon as there is no difference left or it has grown beyond the maximum difference amount. What was settled – and what was not – is recorded in the Creation Log. For individual vendors you can deviate in the Vendor Related Setup. Rules Here, you can use the Rules Engine to set up rule-based configurations. For example, you can define rules for determining the next process step, which decide how a document is forwarded. Show Order No. in Header The Show Order No. In Header toggle controls whether the recognized order number is displayed as a field in the header area of the SQUEEZE document. Disable Document Splitting The Disable Document Splitting toggle disables the "Document Split" function for this document class. When enabled, document splitting is not available on the validation page. Allow Order Allocation The Allow Order Allocation toggle determines whether SQUEEZE line items can be manually allocated to purchase order lines. Ignore Vendor Blocked (Payment) The Ignore Vendor Blocked (Payment) toggle controls whether vendors with the blocked status "Payment" should not be flagged as an error during plausibility checks. Rules In this section, rule-based configurations can be made. The Rules Engine enables automated decisions based on conditions: Next Process Step: Defines the rule group that determines the next process step. For example, you can specify that documents from certain vendors or above a certain amount are routed to custom processing. Account Assignment Code: Defines the rule group that determines the account assignment code to be used. Line Account Assignment: Defines the rule group that assigns an account and dimensions to the individual document lines. See Selecting account assignments based on conditions. Plausibility Rule Group: Defines the rule group whose rules create plausibility check entries. Every active rule whose conditions are met adds an entry with an automatically generated message. For more information on rule-based configuration, see the chapter "Extension Development" under "Rule-based next process step". Vendor Related Setup In this setup, vendor-specific settings are made per SQUEEZE document class. This is done for vendors that deviate from the set client standard. In addition to the auto-completion of positions, deviating amount and quantity tolerances can also be set up here. List Card Autocomplete: The system can remember per vendor how you assigned the lines of a document (type, no., unit of measure, description and dimensions) and fill in the same lines on the next documents. There are three options that can be selected for this. Never: The feature is switched off for this vendor. The "Autocomplete" action is hidden on the validation page and nothing is filled in on import. Manual: The lines are remembered on validation. They are only applied when you run the "Autocomplete" action on the validation page. Automatic: The lines are remembered on validation and applied automatically when a document without an order no. is imported, even if the document class is set to "Manual". If a vendor has a Vendor Related Setup, its option applies instead of the document class option – in both directions. A new Vendor Related Setup starts with the option of the document class. Prerequisites, how it works and examples: see Autocomplete. To see the entries learned for a vendor, use the Autocomplete Entries action in the list. Automatic validation: Enable this option to have Squeeze for BC automatically validate incoming receipts. Please note that this function works only in case of perfectly plausible data. Account assignment code: Specifies the account assignment setup to be used when performing the account assignment in the validation process. Order Match The order reconciliation is used for the automated check of the read out positions with those of the still open orders in Microsoft Dynamics 365 Business Central. In this FastTab, the permissible amount & quantity tolerances for the matching are set up. Additionally, it can be defined whether the matching should take place against purchase orders or deliveries. If "Replace data" is active, the unit price and line amount of the order line replace those of the line (for a receipt also the unit price and product posting groups of the receipt line); otherwise the unit price is only taken over if it is 0. Invoices and credit memos always take over the description, quantity and line discount % of the order line. Differences In the Differences section you decide, for this vendor, whether SQUEEZE settles a small difference between the net amounts of the header and the sum of the line amounts itself. Difference Account: the G/L account the difference is booked to for this vendor. SQUEEZE adds an extra document line with this account and the difference. Leave the field empty to go on reporting every difference for this vendor. Max. Difference Amount: how large the difference may be for it to be settled – an amount in the currency of the document. At 0, nothing is settled. If a vendor has a Vendor Related Setup, both of its fields apply instead of those of the document class – even when they are empty or 0. A new Vendor Related Setup takes over the values of the document class when it is created. For more, see Document Classes Setup.   Account Assignment Setup Here you will find the account assignment setup. If you have standard account assignments for certain VAT. You can store them here. An account assignment setup defines how a document without an order reference is assigned to accounts: for each VAT rate in the document header that has a line in the account assignment setup, SQUEEZE inserts a document line with the stored account and the net amount of that VAT rate – or, through a standard purchase code, several lines across which the net amount is distributed. This pays off for invoices whose individual lines you do not need for posting, such as energy, cleaning, maintenance or office supplies. Each account assignment setup has a code, the account assignment code. It is applied automatically when the document is imported, or by hand with the Apply Account Assignment Code action on the lines of the document. Prerequisites Account assignment code with lines: the Squeeze Account Assignment Setups list contains a code with at least one account assignment setup line. Matching VAT rate: the VAT Rate of a setup line exactly matches one of the tax rates in the document header (Tax Rate, Tax Rate 2 or Tax Rate 3), and the related net amount (Net Amount, Net Amount 2 or Net Amount 3) is not 0. Postable accounts: a G/L account is a posting account that is not blocked and allows direct posting; an item is not blocked. A VAT posting setup exists for the VAT business posting group of the document and the VAT product posting group of the line. For the assignment on import: the document belongs to the Invoice / Credit Memo document class and has no order reference, the code is assigned in the Document Class Setup, in the Vendor Related Setup or by a rule, and Apply automatically is switched on for it. For the Apply Account Assignment Code action, selecting the code in the list is enough. Permissions: with the DEXPRO SQUEEZE User permission set, users can read account assignment setups and therefore apply them to documents. Creating and changing account assignment codes requires DEXPRO SQUEEZE Admin. See Permission sets. Setup Search for the Squeeze Account Assignment Setups list and create a Code with a Description, for example OFFICE. Use the Account assignment setup lines action to open the lines of the code, and create one line for each VAT rate you want to assign. You enter the VAT Rate on the Squeeze Account Assignment Setup Line card; each code has exactly one line per VAT rate. The fields of the line are described below under "Account assignment setup". Assign the code: in the Account Assignment Code field on the Squeeze FastTab of the Document Class Setup, in the Account Assignment Code field of a vendor's Vendor Related Setup, or by a rule (see Selecting account assignments based on conditions). Decide whether the code is applied automatically on import (Apply automatically, Overwrite Squeeze Lines, see below). The fields of the Squeeze Account Assignment Setups list: Code and Description — the account assignment code and what it is for. Vendor No. — optional. If it is filled in, the code appears in the selection list of the Apply Account Assignment Code action only on documents of this vendor. The field has no effect on codes assigned through the document class, the Vendor Related Setup or a rule. Apply automatically and Overwrite Squeeze Lines — control the assignment on import, see below. Assignment and automatic application As soon as an account assignment setup with setup lines has been created and stored in a document class or an vendor related setup, it will be used automatically. When importing a document from Squeeze, the recognized VAT rates are checked against the setup lines of the stored account assignment setup. If matching entries are found, a check is made to determine whether lines with the stored account assignments may be created. In the standard case, this is only done if Squeeze does not supply any lines. In addition, it is possible to set up whether an account assignment setup may be used automatically for validation. This should not be set as default in the document class setup, as this would then apply to all vendors and documents. This option makes more sense for individual vendors (vendor related setup). For automatically use, you can additionally activate that all squeeze lines of a document are overwritten with the configured account assignment setup lines. ("Overwrite squeeze lines" checkbox). Apply automatically Overwrite Squeeze Lines SQUEEZE supplies no lines SQUEEZE supplies lines off – no assignment no assignment on off lines from the account assignment setup are inserted no assignment, the SQUEEZE lines stay on on lines from the account assignment setup are inserted all lines are deleted, then the lines from the account assignment setup are inserted Without Apply automatically the import inserts no lines – not even on documents for which SQUEEZE supplied no lines. The switch works regardless of whether Automatic validation is switched on in the Document Class Setup. Documents with an order reference are never assigned on import. Neither switch has any effect on the Apply Account Assignment Code action. Account assignment setup Setup lines are managed separately for each account assignment code. This is where you create the individual VAT rates for which standard account assignments are to be set. For each VAT rate you then set the account assignment type. Account Assignment Type "One Account" The selection of the account type corresponds to the BC standard: The description can be customized as desired after selecting the number. The Type can be G/L Account, Item, Fixed Asset or Charge (Item). When you select the No., the Description of the account is filled in; the Gen. Prod. Posting Group and VAT Prod. Posting Group are taken from the account as long as they are empty. You can change all three fields. If you later change only the no., posting groups that are already filled in stay – check them then. When the document line is inserted, the posting groups of the setup line take precedence over those of the account. You set the dimensions of the line in the Dimensions section or with the Dimensions action. Business Central determines the VAT percentage of the inserted line from the VAT business posting group of the document and the VAT product posting group of the line – not from the VAT Rate field. That field is only used to find the matching tax rate in the document header. So for the 7% line, choose an account or a VAT product posting group with 7%. Account Assignment Type "Standard Purchase Code" Here you can choose the standard purchase code from the recurring purchase lines. SQUEEZE creates one document line for each line of the standard purchase code, with that line's type, no., description, quantity, unit of measure and dimensions. The posting groups come from the account. The Distribution Type defines how the net amount of the VAT rate is spread across the lines: Distribution Type Quantity of the line Amount of the line Equally 1 net amount divided by the number of lines Proportionally by Quantity quantity from the standard purchase code the line's share of the total quantity times the net amount; the direct unit cost is that amount divided by the quantity Use Fixed Amount quantity from the standard purchase code Amount Excl. VAT of the line in the standard purchase code – regardless of the net amount of the document A quantity of 0 in the standard purchase code counts as 1. Rounding differences with Equally and Proportionally by Quantity go to the last line. Text lines without a type are copied as well but get no amount. Business Central only allows an Amount Excl. VAT on G/L account and item charge lines of a standard purchase code; all other lines get an amount of 0 with Use Fixed Amount.   How it works Which account assignment code applies? Exactly one account assignment code applies to a document. SQUEEZE determines it in this order: Rule: if a rule group is set in the Account Assignment Code field in the Rules section of the Document Class Setup and one of its rules applies to the document, the account assignment code of that rule applies. A matching rule without an account assignment code is skipped. Vendor Related Setup: otherwise the Account Assignment Code from the vendor's Vendor Related Setup for this document class applies, if it is filled in. Document Class Setup: otherwise the Account Assignment Code on the Squeeze FastTab of the Document Class Setup applies. A new Vendor Related Setup takes over the account assignment code of the document class when it is created. If you change the code of the document class afterwards, the vendor keeps its code. If you clear the field for the vendor, the code of the document class applies again – so an empty field does not exclude the vendor from the assignment. To exclude a vendor, give it its own account assignment code with lines for which Apply automatically is switched off. On import When SQUEEZE imports an invoice or credit memo, the account assignment code is only applied if all of these conditions are met: No order reference: SQUEEZE found no order number in the document – not in the header, not as an alternative for the order no. and not in any line. Otherwise Order number found is set in the document header and the document is not assigned. This also applies if the automatic order match is switched off or the order number does not exist in Business Central at all. An account assignment code applies (see above) and Apply automatically is switched on for it. No lines from SQUEEZE – or Overwrite Squeeze Lines is switched on for the code. In that case all lines of the document are deleted first – but only if the account assignment setup inserts a line for at least one tax rate of the document. If none matches, the lines read from the document stay unchanged. Then, for each setup line whose VAT Rate matches a tax rate in the header, the related net amount is assigned. If that net amount is 0, no line is created for the VAT rate. The import asks no questions. "Apply Account Assignment Code" action On the SQUEEZE Document Validation page, choose Functions → Apply Account Assignment Code on the lines. The action works regardless of Apply automatically and Overwrite Squeeze Lines, and also on documents with an order reference. It uses the tax rates and net amounts currently in the document header – so correct them first. If a rule or the Vendor Related Setup supplies an account assignment code, the action uses it without asking. Otherwise the Squeeze Account Assignment Setups list opens, showing all codes without a Vendor No. and the codes for the document's vendor; the code from the Document Class Setup is preselected. If you close the list without selecting a code, the action stops with No Account Assignment Setup selected. If the code has no setup lines, the action stops with No Squeeze Account Assignment Setup found. If the document has an order reference, the system asks: We discovered at least one order number in your document - This feature will delete all existing positions and insert new positions based on tax rates and net amounts of the document header. Do you want to continue? Choosing No cancels the action without changing anything. If the document has lines, the system asks: This will delete all existing positions and insert new positions based on tax rates and net amounts of the document header. Do you want to continue? Choosing Yes deletes all lines – including lines allocated to an order or a receipt. Choosing No cancels the action without changing anything. The action then inserts the lines from the account assignment setup. Line account assignment rules do not run by themselves after the action. If you have set some up, choose Functions → Apply Account Assignment Rules afterwards. Which lines are created Account assignment type "One Account": one line with the Type, No. and Description of the setup line, Quantity 1 and the net amount of the VAT rate as Direct Unit Cost. The line gets exactly the dimensions of the setup line; default dimensions of the account are not added. If the setup line has no dimensions, the document line initially has none either. Account assignment type "Standard Purchase Code": one line per line of the standard purchase code, distributed according to the Distribution Type (see above). The new lines are appended after any existing lines, in ascending order of the VAT rates. If Autocomplete is set to Automatic and the document has no Order No., it runs right after the lines are inserted – on import as well as with the action. If autocomplete has learned a description or dimensions for the vendor and the account, they replace the values from the account assignment setup; an entry without a description or without dimensions leaves the values from the account assignment setup in place. Order of steps on import Header and lines are created from SQUEEZE. Autocomplete (only with option Automatic and without an order no.) Order numbers are collected and Order number found is set if there are any; automatic order match, if set up Account assignment via the account assignment setup (only without an order reference), followed by autocomplete Line account assignment rules – a matching rule also overwrites the account of a line from the account assignment setup Automatic validation, if enabled Examples Example 1: Invoice with 19% and 7% An office supplier (vendor 44000) delivers office supplies and specialist books. Its invoices have no order number, and you do not need the individual lines. The vendor's Vendor Related Setup holds the account assignment code OFFICE, for which Apply automatically is switched on. OFFICE has two setup lines: VAT Rate Account Assignment Type Type No. Description VAT Prod. Posting Group 7 One Account G/L Account 6820 Periodicals, books group for 7% 19 One Account G/L Account 6815 Office supplies group for 19% From an invoice, SQUEEZE reads Tax Rate 19 with Net Amount 250.00 and Tax Rate 2 7 with Net Amount 2 80.00 in the header, but no lines. On import, two lines are created: Type No. Description Quantity Direct Unit Cost VAT % G/L Account 6820 Periodicals, books 1 80.00 7 G/L Account 6815 Office supplies 1 250.00 19 Together they make up the 330.00 net of the document header. If the next invoice contains only office supplies at 19%, only the 6815 line is created. Had SQUEEZE supplied lines, the document would stay unchanged – unless Overwrite Squeeze Lines is also switched on for OFFICE. Example 2: Distributing cleaning costs across three cost centres A cleaning company invoices the cleaning of the whole building every month at 19% VAT. The costs are to be spread across three cost centres. For this, Business Central has the standard purchase code CLEANING with three lines, all on G/L account 6330 (Cleaning): Line Cost centre Quantity Amount Excl. VAT 1 ADMIN 2 250.00 2 PRODUCTION 5 450.00 3 SALES 3 300.00 The account assignment code CLEANING has one setup line with VAT Rate 19, Account Assignment Type Standard Purchase Code and Standard Purchase Code CLEANING. For an invoice of 1,000.00 net, these lines are created depending on the Distribution Type (quantity × direct unit cost = line amount): Cost centre Equally Proportionally by Quantity Use Fixed Amount ADMIN 1 × 333.33 = 333.33 2 × 100.00 = 200.00 2 × 125.00 = 250.00 PRODUCTION 1 × 333.33 = 333.33 5 × 100.00 = 500.00 5 × 90.00 = 450.00 SALES 1 × 333.34 = 333.34 3 × 100.00 = 300.00 3 × 100.00 = 300.00 Total 1,000.00 1,000.00 1,000.00 If the invoice amount rises to 1,100.00, Equally (366.67 / 366.67 / 366.66) and Proportionally by Quantity (220.00 / 550.00 / 330.00) distribute the new amount. Use Fixed Amount still sets 250.00 / 450.00 / 300.00 – you balance the difference of 100.00 by hand. All three lines have the same G/L account. Autocomplete recognises lines from the account assignment setup only by type and no. If it has learned an entry with dimensions for G/L account 6330 for this vendor and is set to Automatic, all three lines get the same dimensions. So set autocomplete to Manual or Never in this vendor's Vendor Related Setup, or delete the entry. Example 3: A code for a single vendor, documents with an order number The Document Class Setup holds the account assignment code GENERAL, without Apply automatically. For an energy supplier (vendor 70000) there is a Vendor Related Setup with the account assignment code ENERGY: Vendor No. 70000, Apply automatically on, one line for 19% with G/L account 6325 (Gas, electricity, water) and the cost centre ADMIN. Monthly invoice of the energy supplier without an order number: on import, one line on 6325 with the net amount and the cost centre ADMIN is created. Invoice of the energy supplier on which SQUEEZE found an order number: Order number found is set in the header, and nothing is assigned on import. If you choose Apply Account Assignment Code, the action uses ENERGY without a selection list – after the question about the order number. Invoice of another vendor without a Vendor Related Setup: GENERAL applies; because Apply automatically is off there, nothing is assigned on import. The action opens the selection list with GENERAL preselected. ENERGY does not appear in it, because vendor no. 70000 is entered on it. Limitations Assignment only works on the three tax rates in the document header, and the VAT rate must match exactly. If the same tax rate appears twice in the header, only the first net amount is assigned. If there is no setup line for a tax rate of the document, its net amount is missing from the lines. Unless the line comparison is disabled, the plausibility check reports the difference between header and line amounts. Use Fixed Amount takes the amounts from the standard purchase code even if the invoice is for a different amount. The net amount of the VAT rate must still not be 0, otherwise no line is created. The dimensions of a line come only from the setup line or the line of the standard purchase code – and from autocomplete, if it applies. Default dimensions of the account are not added. Unlike autocomplete and line account assignment rules, the account assignment setup checks the account when inserting the line: a blocked G/L account, a G/L account without direct posting or a blocked item causes an error message – on import as well as with the action. On import, assignment only happens in the Invoice / Credit Memo document class and only without an order reference. Exactly one account assignment code applies to a document; several codes cannot be combined. Troubleshooting No lines are created on import Is Order number found set in the document header? Then nothing is assigned on import. Drilling down on the field shows which order numbers were found. Apply the code with the Apply Account Assignment Code action. Does the document belong to the Invoice / Credit Memo document class? Which account assignment code applies? Check rules, Vendor Related Setup and Document Class Setup in this order. Remember that a Vendor Related Setup took over the code of the document class when it was created. Is Apply automatically switched on for that code? Did SQUEEZE supply lines? Without Overwrite Squeeze Lines the document then stays unchanged – with it as well, if no tax rate of the document matches the account assignment setup. Does the VAT Rate of a setup line exactly match Tax Rate, Tax Rate 2 or Tax Rate 3, and is the related net amount not 0? Message "No Squeeze Account Assignment Setup found." The account assignment code has no setup lines. If the code comes from a rule or from the Vendor Related Setup, the action uses it without a selection list – create lines for this code or enter a different code there. Message "No Account Assignment Setup selected." You closed the selection list without choosing a code. Nothing was changed on the document. Message "No DXP SQZ Document Lines found." This message can appear with the account assignment type Standard Purchase Code and the distribution type Equally or Proportionally by Quantity if the standard purchase code contains no line with a type and no. Complete the standard purchase code. The line has the wrong VAT percentage The VAT percentage comes from the VAT product posting group of the line. Enter the matching VAT Prod. Posting Group on the setup line, or choose an account whose group matches the VAT rate. Error message about the no. or the account With the account assignment type One Account no No. is entered, or the account has been blocked in the meantime or does not allow direct posting. Correct the setup line. The lines do not add up to the net amount of the document A setup line is missing for one of the tax rates, the same tax rate appears twice in the header, or the distribution type is Use Fixed Amount. Dimensions are missing or different The line only gets the dimensions of the setup line – enter all the dimensions you need there. A learned autocomplete entry or a line account assignment rule can change them afterwards. Related topics Document Classes Setup Vendor Related Setup Selecting account assignments based on conditions Autocomplete SQUEEZE Document Validation Order & Goods Receipt Reconciliation Plausibility Checks Field Mapping In Metadata Mapping, the field mapping of each document class is downloaded, creating a set of standard fields and their usage in Microsoft Dynamics 365 Business Central. Metadata assignment Additional SQUEEZE fields which deviate from the standard add. After assignment: Custom Field Mapping You may always want to write certain information in certain fields in your process that deviates from the standard field assignment. In the following example, the service date recognized by Squeeze is always written in the “Booking date” field - in addition to the standard behaviour. The service date therefore remains filled. Open the field assignment in the document class setup: Then open the “User-defined field assignment”: Then make the desired assignment: User specific setup In this setup, user-specific settings are configured. Users can customize the app to suit their workflow and peripheral devices. The overview displays all users and their respective settings. When opened, it automatically shows the current user. Viewer Use external viewer only: When enabled, the viewer is displayed exclusively in detached (external) mode. This is particularly recommended when working with two monitors. The detached viewer updates automatically when switching between documents. Viewer Resolution: Allows adjusting the viewer resolution. The options High and Low are available. Validation Back to List After Validation: When enabled, the app automatically navigates back to the document overview after completing the validation. This speeds up processing when validating multiple documents sequentially. Deactivate Validation Dialog: When enabled, the confirmation dialog after completing the validation is suppressed. For the user, this setting applies instead of the setting of the same name in the Document Classes Setup. Users without a user specific setup get the setting of the document class. The switch is enabled in a newly created setup. Squeeze Master Data Tables Standard Tables Unless deactivated, this master data is automatically synchronized with the Squeeze client. It is still necessary to upload the master data initially. For vendors, vendor bank accounts and the company, the OnInsert, OnModify and OnDelete events are monitored in the background and changes are synchronized to Squeeze immediately. No separate job is needed for this. Orders Orders are transferred to Squeeze by a background job: Releasing a purchase order and posting an invoice directly from the order only add the change to a queue. The release or posting does not wait for Squeeze. The recurring job queue entry DEXPRO SQUEEZE - Master Data Synchronisation uploads the queue every 5 minutes: released orders with their lines that are not yet fully invoiced. After an invoice has been posted, the fully invoiced lines of an order that is still open are removed from Squeeze. Receipts posted without an invoice do not trigger a transfer – not even when a receipt is posted pallet by pallet in many separate postings. If an entry cannot be transferred, for example because Squeeze is not reachable, it is retried with the next run. The remaining entries are transferred regardless. The job queue entry is created automatically as soon as orders are synchronized: by the initial master data upload, by the "Create Jobs" action in the SQUEEZE Setup and when "Do not Synchronize" is switched off again for the orders master data table. When the app is updated, it is created if orders are already being synchronized. Earlier versions created a separate one-time job queue entry for every posting of an order. With postings in quick succession – for example a receipt per pallet – a posting could fail with a message that the job queue entry does not exist. Such one-time entries are removed when the recurring entry is created. The “Uses external ID” field is supported from Squeeze version 2.13 and allows you to manage Squeeze master data from third-party software. In this case BC. Generic Master Data Tables To transfer additional master data to Squeeze, maintain it in the generic master data table setup. Attachment of the table to be transferred The table to be transferred is entered in the “BC table no.” field or selected via the drilldown. The name can then be adjusted in the “Squeeze table name” field. The “Synchronization activated” field is used to specify whether this table is currently to be synchronized or not. Selection of the fields to be transferred You can access the setup via the “Field Selection” menu item. The fields to be synchronized are selected here. Creation of the Squeeze master data table from BC Once a BC table has been entered and its fields selected for synchronization, a new squeeze table can now be created from BC. The “Create squeeze table” button is available for this purpose. After creation, the “Squeeze table ID” field is set in the overview. The new table is now available on the squeeze page. The selected fields have now been automatically created here as columns. Synchronization of the data After creating the squeeze table, the user is asked whether a synchronization task should be created. If this is active, the master data is automatically transferred at the set frequency. Alternatively, the master data can also be transferred manually once using the “Synchronize now” button. Deleting the master data table When deleting a list entry, you are asked whether the Squeeze master data table should also be deleted. If this is confirmed, the squeeze table created from BC will be irretrievably removed.   Filter Rules Via the Manage Filter Rules menu item, you can define filters that determine which records from the BC table should be synchronized to SQUEEZE. For example, you can transfer only records of a specific type or with a specific status. Refresh Columns If the field selection of a generic master data table has changed, the Refresh Columns action can be used to update the columns in the SQUEEZE table without having to recreate the entire table. Synchronization Status For each generic master data table, the time of the last synchronization (Last Synced) and any error text (Last Sync Error) are displayed. This helps with troubleshooting synchronization issues. Note on "Uses External Id" The Uses External Id field is supported from SQUEEZE version 2.13 onwards. When enabled, master data in SQUEEZE is managed via an external ID (from Business Central). This enables bidirectional referencing and prevents duplicate creation of master data. SQUEEZE The SQUEEZE page must also be prepared for fetching documents from Microsoft Dynamics Business Central. Each document class that is to be retrieved from Microsoft Dynamics Business Central requires its own export interface of the type "Pull". In addition, the document class ID, the export interface ID and the master data table ID must be stored in Microsoft Dynamics Business Central in the setup for the SQUEEZE document classes. If the latest SQUEEZE for BC version is not used, the following batch class properties must be set in the SQUEEZE client: Role Center Activities SQUEEZE for BC extends the Purchasing Agent Role Center with several activity tiles that provide an overview of the current processing status of SQUEEZE documents. SQUEEZE Activities These tiles display the number of SQUEEZE documents that require processing (open documents, documents created today, etc.). On Hold Documents These tiles display the number of documents on hold, broken down by hold reason: Total On Hold Documents: The total number of all documents on hold. Vendor Not Found: Documents where the vendor was not found in the system. Service Clarification Needed: Documents where service or delivery details need to be clarified. Awaiting Goods Receipt: Documents waiting for goods to be received. Each tile is linked via drilldown to the filtered Squeeze Document Overview. Order Match Activities These tiles display the number of documents with deviations from order matching: Total Differences Identified: The total number of all documents with identified deviations. Quantity Differences: Documents with quantity deviations. Price Differences: Documents with price deviations. Receipt Date Differences: Documents with receipt date deviations. Discount Differences: Documents with discount deviations. Navigation In the Role Center, two navigation items are available under the Squeeze group: Current Company: Opens the SQUEEZE Document Overview for the current company. Cross-Company: Opens the cross-company document overview. The SQUEEZE Setup can be accessed directly from the Setup area of the Role Center. Validation Visual inspection of the read documents SQUEEZE Document Overview The document overview lists all documents that have been read by SQUEEZE. By double-clicking with the mouse or via Edit/View, a single document is opened in the validation view. Start Download Documents now This function is used to manually execute the document pickup from SQUEEZE. Optionally, this is controlled and executed via the corresponding background job. Upload Documents Use this function to upload documents directly from BC to your Squeeze tenant. Navigation Import Queue Entries This menu displays a list of SQUEEZE vouchers that are ready to be imported into the SQUEEZE for BC app. By changing the system filter it is also possible to view already imported vouchers. Cross Company Documents Opens an cross-company document overview. Queue Opens an overview that gives you information about the documents in the SQUEEZE queue of the connected client.     Cross Company Document Overview The cross-company document overview provides a consolidated view of all SQUEEZE documents across all Business Central companies where SQUEEZE is activated. Overview The view displays the following KPIs for each company: Company: The name of the respective Business Central company. Open Documents: The number of open SQUEEZE documents. Custom Processing: The number of documents in "Custom Processing" status. Overdue Documents: The number of overdue documents. Duplicates: The number of documents flagged as duplicates. Rejected Documents: The number of rejected documents. Documents Created Today: The number of documents created today. My Open Documents: The number of documents assigned to the current user. Additionally, order matching results are summarized across companies: Total Differences Identified: Total number of documents with order match deviations. Price / Quantity / Receipt Date / Discount Differences: Breakdown by deviation type. Navigation Each KPI is implemented as a drilldown: clicking on a value opens the correspondingly filtered document overview of the respective company in a new tab. Refresh The data is loaded asynchronously in the background and refreshes automatically every 60 seconds. A manual refresh can be triggered via the Refresh data action. The cross-company document overview is accessible from the document overview via the Cross-Company Documents action or via the Role Center (Squeeze > Cross-Company). Import Queue Entries The import queue is a middle layer that imports SQUEEZE vouchers into the appropriate target companies - the target company must match the current BC company (important: the name (primary key) is crucial, not the display name) in which the vouchers are downloaded. If no target company has been detected, the documents for validation will be created in the fallback company that has been set up. Navigation Import Queue Setup   Fallback Company Specifies the value of the fallback client. This client is used to import documents that have an empty target client in the import queue. Warning time span (hours) Specifies the time period after which a warning should be displayed if there are unprocessed entries. Process Handle unprocessed entries Generates SQUEEZE documents from unprocessed entries in the active company. This usually happens when the recognized company does not match any company in the database.   Import Buffer The Import Buffer action opens a page where SQUEEZE document IDs can be entered manually. This is useful when a specific document needs to be downloaded from SQUEEZE, e.g. when a document was not fetched automatically. System Filter By default, the Import Queue only shows unprocessed entries for the current company. Using the system filter, you can also view already processed entries as well as entries from other companies. The Target Company column is highlighted in red when the target company differs from the current company. This indicates that the document is intended for a different company. SQUEEZE Document Validation Voucher validation is the main working area of the application. Here the user checks the read documents, completes and confirms missing information. Menu Process Open field training The supplier-specific field training is opened over here. Open line training The supplier-specific position training is opened over here. Recreate result Here over the document is sent again to SQUEEZE to the extraction. There the Readout result re-evaluated based on current master data and training and then made available for collection again. Start splitting This is used to call the document separation. This is used if a supplier has sent several invoices in one PDF. Autocomplete Fills in the lines with the values the system remembered from earlier validations of this vendor: type, no., unit of measure, description and dimensions. The action is shown if the Autocomplete Option in the Document Classes Setup or the Vendor Related Setup is not set to "Never". It overwrites the recognised lines – so run it before making your own corrections. More under Autocomplete. Order match The order comparison is opened here. Validate This is used to complete the validation process of the document. Duplicate check Over here, the duplicate check is performed manually. Reject document This action lets you reject a document. The document is kept in the dedicated status Rejected – it is not deleted – and you can add a comment while rejecting it. A rejection can be taken back later with Withdraw document rejection. Afterwards an e-mail can be sent to the vendor. For that, an account has to exist under Email Accounts and be set as the default under Email Scenario Assignment. The Business Central mail module then opens with the rejection comment, the document reference and the sender of the validation already filled in, and the document attached. SQUEEZE brings its own e-mail scenario for this: SQUEEZE Document Rejection. Assign an account to it under Email Scenario Assignment if rejections are to go out from a different mailbox than the rest of your e-mail. Without an assignment of its own, the default account is used. Creation Log This action opens the Creation Log of the document: what the automatic steps did while it was created and validated – autocomplete, order match, account assignment, difference, VAT difference, validation and the next process step – and what they did not do, and why. Navigation Dimensions Here you can reach the dimension menu to define dimensions for the document header. Actions Use external viewer The viewer is undocked over here. This allows you to work on two monitors. Move document This is used to move a document to another client. Download attachments Over here you download the attachments of the document. Once the download is complete, they will be displayed in the Attachments infobox. Fasttabs Document This area displays the document head information and the SQUEEZE Viewer. Header fields These fields are prefilled with the results from the document reading. The user checks these and corrects or enriches them with further data and thus completes the reading result. The three dots highlight the location of the respective read result in the viewer. Responsibility Center and VAT Bus. Posting Group On invoices and credit memos, the Buy-from Vendor section also shows the fields Responsibility Center and VAT Bus. Posting Group. They are not read from the document; they determine the values the purchase document in Business Central is created with. Responsibility Center — filled in on import and when the vendor changes: with the responsibility center your user setup (or the company information) restricts purchasing to, otherwise with the vendor's – just like on a purchase document entered manually. VAT Bus. Posting Group — filled in with the vendor's group, and the lines take it. If you change the group, for example for a delivery from another country, it is passed on to every line that is not allocated to an order or receipt line, and the VAT of those lines is recalculated. Lines taken over from an order or receipt keep the group of the order or receipt line. Changing the vendor resets both fields to the defaults of the new vendor. Order confirmations do not show these two fields: the existing order keeps its responsibility center and VAT business posting group. Viewer On the right side the SQUEEZE Viewer is displayed. This is not a PDF, but an integrated web component, which is remotely controlled from the validation. It serves for the pictorial representation of the document and for the highlighting of Findings of read values. Furthermore, the supplier-specific field training is also carried out here. Lines In this area the read positions are displayed. The user checks these and corrects or enriches them with further data and thus completes the reading result. If the reading result is not sufficient for invoices with purchase order reference, the purchase order/goods receipt lines can be imported directly. Dimensions Here the shortcut dimensions 1 & 2 of the document are displayed. SQUEEZE Details SQUEEZE specific document information is displayed here. Infoboxes The respective info boxes are only displayed depending on the situation. Plausibility entries All topics to be clarified for a successful validation are listed here. Metadata boxes The metadata mapping is only displayed if additional fields deviating from the standard have been transferred by SQUEEZE. Metadata mapping header fields Here additional fields from SQUEEZE are listed, which do not belong to the standard assignment of header fields. Metadata mapping position fields Here additional fields from SQUEEZE are listed, which do not belong to the standard assignment of the positions. Order matching boxes The order matching boxes are only displayed if one or more order numbers have been recognized on the document. Order matching info (prices) Here the price comparison is displayed for the selected line. The results of SQUEEZE, the delivery, the order and the current line are compared. Order matching info (quantities) Here the quantity comparison is displayed for the selected line. The results of SQUEEZE, the delivery, the order and the current line are compared. Attachments This info box is only displayed if the attachments have been downloaded before. The attachments can be removed again via the three dots. Put Document On Hold / Remove Document From Hold The Put document on hold action allows you to temporarily put a document on hold. A dialog opens where you must select a reason: Vendor Not Found: The vendor was not found in the system. Service Clarification Needed: Delivery or service details need to be clarified. Awaiting Goods Receipt: Waiting for goods to be received. An optional free-text note can also be provided. Documents on hold cannot be validated until the hold is removed via Remove document from hold. Documents on hold are displayed in the Role Center in dedicated activity tiles, broken down by reason. Withdraw Document Rejection If a document has already been rejected, the rejection can be withdrawn via the Withdraw document rejection action. The document then returns to its previous status. Move Document to Other Company The Move Document to other Company action (in the Actions menu) allows you to move a document to another company. The document is deleted in the current company and recreated in the target company. Create/Find Vendor The Create/Find Vendor action allows you to search for a matching vendor in the system or create a new one based on the recognized text fields (name, address, VAT registration number, etc.). Create Missing Bank Account The Create Missing Bank Account action allows you to create a vendor bank account from the recognized IBAN, provided the IBAN was recognized on the document but no matching bank account exists for the vendor. Apply Account Assignment Code The Apply Account Assignment Code action in the lines allows you to delete all positions and automatically generate new lines based on a configured tax-based account assignment setup. This function is available through the Account Assignment Setups. Viewer Modes The SQUEEZE Viewer in the document validation supports three display modes: Document Overview: Displays the entire document in the viewer. Position Focus: Focuses the viewer on the line items area of the document. Detached: Opens the viewer in a separate browser window (see also "External Viewer"). Field Alternatives When SQUEEZE recognizes multiple possible values for a field during document reading (e.g. multiple possible vendor numbers), these are provided as field alternatives. The field alternatives can be viewed via the info box. The user can then select the appropriate value. Vendor-specific Training Training represents an essential optimization component of processing. If data is not clearly recognized by the system, supplier-specific training can be applied, which increases the degree of automation when entering invoices. When the training mode is started, all relevant fields for a training can be selected. Any number of trainings can be created per supplier and per invoice field. External invoice numbers cannot usually be checked for content in the system, as no data exists for verification. This field is ideal for training, for example. In Business Central you start the training on the SQUEEZE Document Validation page with the Open field training and Open line training actions. The training itself takes place in the SQUEEZE Viewer on the right and is saved in SQUEEZE – Business Central does not store any trainings itself and only passes on which vendor you are training for. To see the effect on the current document right away, have it read again with Recreate result afterwards. Field training or line training? Field training Line training Action Open field training Open line training Used for Header fields – values that occur once per document Lines – the columns of the line item table Typical fields Document Reference (the vendor's invoice number), Document Date, Service Date, Order No., Net Amount, Total Amount, IBAN, VAT Registration No. the values in the SQZ columns of the lines, e.g. SQZ Item No., SQZ Description, SQZ Quantity, SQZ Unit Price In the viewer mark the anchor and the value – see Head field training mark a region covering the whole column – see Position field Training The quickest way to see whether a header field was read from the wrong place is the three dots (…) next to the field: the viewer highlights where SQUEEZE found the value. For lines, compare the SQZ columns with the document in the viewer; SQZ Description and SQZ Unit of Measure are hidden by default – show them with Personalize. Which SQUEEZE field ends up in which field of the Squeeze document is defined by the Field Mapping. Training improves what SQUEEZE reads from the document. If the value read is correct but Business Central assigns the wrong account, item or dimensions, training will not help. Use Autocomplete, the account assignment setup or line account assignment rules for that. Prerequisites Connection to SQUEEZE: in the SQUEEZE Setup, Activated is switched on and the Version (Squeeze Tenant) field is filled in. If either is missing, the actions are greyed out. PDF document: the actions are only available for documents that are PDF files. For other file types they are greyed out. Correct vendor: the Buy-from Vendor No. field contains the vendor you want to train for. When you open the training, Business Central passes this number to the viewer – the same number under which Business Central transfers the vendor to SQUEEZE as master data. Business Central does not check whether the field is filled in, so enter or correct the vendor before you open the training. Viewer mode Document Overview or Detached: in Document Overview the training opens in the viewer embedded in the page, in Detached in the external viewer – which has to be open for it. In the Positions Focus viewer mode the actions are hidden. Permissions: the permission sets DEXPRO SQUEEZE User and DEXPRO SQUEEZE Admin include the page with the training actions (see Permission sets). Business Central has no separate permission just for training. Business Central loads the viewer with the API key from the SQUEEZE Setup – or with a document-specific token if Use Document Token is switched on there. Starting and carrying out the training Open the document from the Squeeze Documents list (see SQUEEZE Document Overview). It opens on the Squeeze Document page. Check the vendor in the Buy-from Vendor No. field and correct it if necessary. If the Viewer mode is not set to Document Overview, change it. In the action bar, under Process, choose Open field training (header fields) or Open line training (lines). The action then changes to Close field training or Close line training. As long as one of the two trainings is open, the action for the other one is greyed out. Train in the viewer as described under Head field training or Position field Training below. Close the training with Close field training or Close line training. If you move to the next or previous document, Business Central closes an open training automatically. Decide whether to correct the current document by hand or have it read again with Recreate result – see Applying the training to the current document below. The training window is displayed within the viewer at the bottom of the screen.   Head field training Train a field After the training function has been started, the field to be trained must be selected. After selecting the appropriate field, define the anchor. Anchor in this case means the reference term. In this case, the term for the external document number attached to the respective invoice. The anchor term is to be marked with the right mouse button on the document in the viewer and is then highlighted in yellow. Then click on the "Value" field in the action area and then on the value to be searched for. This is also to be marked with the right mouse button. If the searched value is not a coherent value, an arbitrarily large area can also be marked with the right mouse button in order to read out all desired information. If the information is specified, the training can be saved via "Train". The system generates a "regular expression" - this can be optimized by trained specialists or IT staff at any time. E.g. blanks can be ignored, since these are rarely also indicated in the ERP system / in the booking.     Testing and review of existing training With "Test" an overview of all previous head field trainings is displayed. The results are output directly as well. Double-clicking on an entry highlights the anchor and the value in the viewer. Removing a training To remove a training, open the overview of existing trainings and select the entry to be removed. The entry is deleted with the delete key "Del". Position field Training Train a column After the training function has been started, the field to be trained and the corresponding column must be selected. After this has been selected, the region must be defined. This should be selected so that it covers the entire column of a field if possible. The region is to be marked with the right mouse button on the document in the viewer and is then highlighted in yellow. It should be noted that no regions should overlap with regions that have already been trained. If the information is given, the training can be saved via "Train". Testing and review of existing training With "Test" an overview of all previous position field trainings is displayed. By double-clicking on an entry, the respective trained area is displayed. Removing a training To remove a training, open the overview of existing trainings and select the entry to be removed. The entry is deleted with the delete key "Del". Applying the training to the current document A training does not change the document you trained on by itself: the header fields and lines in Business Central stay as they were imported. You have two options: Correct by hand and validate as usual. The training then takes effect from this vendor's next document on. Recreate result: SQUEEZE reads the document again with the new training. This lets you check on the same document whether the training works. Recreate result Choose Recreate result and confirm the question Do you want to recreate the result? Business Central sends the document back to the SQUEEZE extraction step. In Business Central the document gets the status Deleted; the page closes and – if there are any – reopens with the remaining imported documents. As soon as SQUEEZE has finished processing the document, Business Central picks up the new result the next time documents are downloaded: automatically via the job queue (see SQUEEZE Setup) or straight away with Download Documents now in the Squeeze Documents list. Until then the document has the status Resynchronize in the Core Documents list. A new Squeeze document with a new number is created. It is processed like a newly imported document of the same document class – for example with order matching, autocomplete and line account assignment rules. If automatic validation is enabled, the document is validated provided it passes all plausibility checks. Corrections you made on the previous document are not carried over – the new document contains only the new extraction result. So choose Recreate result right after the training, before you continue working on the document. For documents with the status Deleted or Rejected the action is greyed out. Effect on future documents A training applies to the vendor you opened it for and is used by SQUEEZE when it reads this vendor's following documents. There is nothing else to set up in Business Central. You review and remove existing trainings in the viewer (see Testing and review of existing training) – Business Central does not display trainings. If you use Autocomplete for the vendor, keep in mind: autocomplete recognises a line by the values SQZ Item No., SQZ Unit of Measure, SQZ Description and SQZ Unit Price. If, after a line training, SQUEEZE reads different values into these columns than before, the remembered entries no longer match. Assign the affected lines once by hand and validate the document – autocomplete then remembers the lines with the new values. Examples Example 1: Invoice number read from the wrong place A supplier (vendor 20000) prints "Customer No. 10442" in the invoice header and "Invoice No. INV-24-0815" below it. SQUEEZE reads 10442 as the invoice number, so the Document Reference field shows 10442. Because the customer number is the same on every invoice from this supplier, every further invoice would get the same document reference – and the duplicate check, which compares the document reference and the vendor, would flag it as a duplicate. Click the three dots next to Document Reference – the viewer highlights 10442 next to "Customer No.". Make sure the Buy-from Vendor No. field contains 20000 and choose Open field training. In the training window, select the field for the invoice number. Mark the anchor "Invoice No." with the right mouse button, click "Value", mark "INV-24-0815" and save with "Train". Use "Test" to check that the training returns INV-24-0815, then close it with Close field training. Choose Recreate result. After the next download, the new document shows INV-24-0815 in Document Reference – and so do the following invoices from vendor 20000. Example 2: Item numbers missing on the lines On a wholesaler's invoices (vendor 30000) the item number is printed in its own "Item No." column to the left of the description. Even so, SQZ Item No. stays empty in the lines of the Squeeze Document page. Choose Open line training. Select the field for the item number and the corresponding column. Mark a region covering the whole "Item No." column with the right mouse button – without overlapping regions that have already been trained – and save with "Train". Close the training with Close line training and choose Recreate result. On the new document, SQZ Item No. is filled in on the lines. If you have been using autocomplete for this vendor, assign the lines once by hand and validate: the previous entries were remembered with an empty item number and no longer match. Limitations You can only start a training on the Squeeze Document page. The Viewer in Target Document has no training actions. Training is only possible for PDF documents. In the Positions Focus viewer mode the actions are hidden. Order confirmations usually open in this mode – switch the viewer mode to Document Overview to train. Field training and line training cannot be open at the same time. A training applies only to the vendor it was created for. A training only affects the current document through Recreate result – and your corrections on this document are lost in the process. Business Central does not display trainings; reviewing and removing them is only possible in the viewer. Troubleshooting The "Open field training" and "Open line training" actions are missing The viewer mode is set to Positions Focus. Switch it to Document Overview. The actions are greyed out Is the other training still open? Close it first. Is the document a PDF? Training is not possible for other file types. Is there a connection to SQUEEZE? In the SQUEEZE Setup, Activated must be switched on and Version (Squeeze Tenant) must be filled in. No training window appears in the viewer Check the viewer mode. In Detached the training window appears in the external viewer – open it if it is closed, then choose the action again. In Positions Focus the training actions are hidden; switch the viewer mode to Document Overview. If Use external viewer only is switched on in the User specific setup, the page opens the viewer detached. The training then opens in the external viewer. "Recreate result" is greyed out The document has the status Deleted or Rejected, or there is no connection to SQUEEZE (see above). The document does not come back after "Recreate result" Are documents being downloaded? Choose Download Documents now in the Squeeze Documents list or check the job queue entry. Has SQUEEZE finished processing the document? Business Central only picks up the new result once the document has reached the Export, Backup or Delete step in SQUEEZE. Until then it stays in the Core Documents list with the status Resynchronize. See also Documents are not retrieved from Squeeze and remain there in the export step. Message "Document … could not be retrieved from SQUEEZE …" SQUEEZE no longer knows the document or cannot be reached, so Recreate result cannot have it read again. Nothing was changed on the document. Check the connection in the SQUEEZE Setup and whether the document still exists in SQUEEZE; otherwise process the document by hand. The new document still contains the wrong value Was the training saved with "Train"? Check it in the viewer with "Test". Did Buy-from Vendor No. contain the right vendor when you opened the training? Business Central passes the number that is entered at that moment. If you changed the vendor afterwards, close the training and open it again. Was the same vendor recognised on the new document? A training applies only to the vendor it was created for. For line training: does the region overlap a region that has already been trained? Related topics SQUEEZE Document Validation External Viewer User specific setup SQUEEZE Setup Field Mapping Autocomplete Order Confirmations Document Split The separator function is mainly intended for email invoices. When suppliers do not adhere to the email invoice delivery default (one invoice per PDF file). You start the split on the SQUEEZE Document Validation page with the Start Splitting action. From the pages you put together in the split dialog, SQUEEZE creates new documents, which Business Central then downloads like any other document. As soon as every page of the original belongs to a new document, the original gets the status Deleted. You can also use the split to put the pages of a PDF into a new order (see Example 3). Prerequisites Splitting allowed: in the Document Class Setup, FastTab Squeeze, the Disable Document Splitting switch is off for the document's class. This is the default. There is no per-vendor setting. PDF document: the document is a PDF. For documents in any other file format the action is greyed out. Document still open: the document's status is neither Rejected nor Deleted. Documents that are on hold can be split. SQUEEZE connected: in the Squeeze Setup, Activated is switched on and the connection to your SQUEEZE tenant is established – the Version (Squeeze Tenant) field is filled in. The split dialog is a page of your SQUEEZE system; Business Central opens it with the same connection as the viewer. Permissions: the permission sets DEXPRO SQUEEZE User (DXP SQUEEZE User) and DEXPRO SQUEEZE Admin (DXP SQUEEZE Admin) contain everything splitting needs. See Permission sets. Starting the split In the Squeeze Documents list, open the document that contains several invoices. Don't enter anything yet – data entered on the original is not carried over to the new documents (see below). On the validation page, choose the Start Splitting action. The Squeeze Viewer window opens with the SQUEEZE split dialog. From this moment on the split counts as started. In the split dialog In the new window, a dialog is started to separate the documents from each other and thus turn one document into several. On the left side all pages of the original PDF are listed. In the middle is the area for rebuilding and on the right you can see the currently selected page. To split a document, the pages belonging to an invoice are transferred individually to the center area either by dragging and dropping them with the mouse or by pressing the arrow key on the keyboard. There you can also correct the order of the pages. If the invoice document is correctly separated, the creation of a new single document can be started with "Create document". The new document is read out directly by SQUEEZE, processed and, as soon as it is ready, also made available in the overview list. This process is repeated until the original document has been completely separated. Finishing the split Once you have created all documents, close the window. Business Central then asks SQUEEZE which pages of the original already belong to a new document and reacts as follows: State of the split What happens No page assigned The split is discarded. The document stays as it is and can be edited and validated as usual; the Start Splitting action is available again. Some pages assigned The split stays open. The validation page is reopened, the message The Document is not completely split. Please split all pages. appears, and the Squeeze Viewer window opens again. All pages assigned The original gets the status Deleted. The validation page is closed and – if there are still documents with the status Imported – reopened on the next document. While the split is open, the validation page shows the Finish Splitting action instead of Start Splitting. It opens the Squeeze Viewer window again; when you close it, Business Central checks again as described above. If you open a document whose split is still open, the message The Document is not completely split. Please split all pages. appears as well and the window opens by itself. This applies when the viewer is embedded in the page (Viewer mode Document Overview or Positions Focus). In the Detached viewer mode, continue the split with Finish Splitting. A document with an open split cannot be validated. The Plausibility Entries FactBox shows The Document is not completely split. Please split all pages., and Validate stops with the message The document is not valid - please check the plausibility entries in the factbox to the right, solve the problems and try again. What happens to the original Status Deleted: as soon as all pages are assigned, the original gets the status Deleted. Its Note field then reads, for example, Deleted by user JSMITH - Reason: Split completed. Gone from the list: the Squeeze Documents list hides deleted documents by default. You find the original in the Deleted view, which also shows the Note column. Read-only: the original's fields are locked and most actions are greyed out. If the viewer is embedded, opening it shows the message Split complete. This document will be deleted. Removed for good: the automatic cleanup (a background job of the Squeeze Setup) permanently deletes documents with the status Deleted once their import date lies as far back as the Cleanup Interval (Date Formula) in the Squeeze Setup specifies – -1M, one month, by default. What counts is the day of the import, not the day of the split. No data carried over: whatever you entered or corrected on the original – such as vendor, posting date, lines or dimensions – is not transferred to the new documents. So split a document before you start working on it. The new documents SQUEEZE reads each new document itself. Business Central picks it up with the next document download – through the background job, or immediately with the Download Documents now action in the Squeeze Documents list. Each new document appears in the Squeeze Documents list with the status Imported and its own reading result. It goes through the same processing as any other newly downloaded document – including automatic validation, if that is switched on. To see whether SQUEEZE is still processing a new document, use the Queue action in the Squeeze Documents list (see SQUEEZE Queue). Examples Example 1: Three invoices in one PDF A supplier sends a five-page PDF that contains three invoices: Pages Content 1–2 Invoice INV-1001 3 Invoice INV-1002 4–5 Invoice INV-1003 You open the document and choose Start Splitting before entering anything. In the Squeeze Viewer window you move pages 1 and 2 to the center area and start "Create document". You repeat this with page 3 and then with pages 4 and 5. You close the window. All five pages are assigned: the original gets the status Deleted and disappears from the list. After the next document download, three new documents are in the Squeeze Documents list – one per invoice. You process and validate them as usual. Example 2: Split interrupted As in example 1, but you close the window right after INV-1001 and INV-1002. Pages 4 and 5 do not belong to a document yet. So The Document is not completely split. Please split all pages. appears and the window opens again. You create INV-1003 and close the window – now the split is complete. Example 3: Reordering pages A three-page invoice was scanned with the last page first. You move all three pages to the center area in the correct order and create a single new document. Since this assigns every page, the original gets the status Deleted and you continue with the new document. Example 4: Started by mistake You chose Start Splitting although the document contains only one invoice. Close the window without creating a document: no page is assigned, the document stays unchanged and can be validated as usual. If the validation page still shows Finish Splitting afterwards, choose that action and close the window once more. Limitations Documents are split by whole pages. If two invoices are printed on the same page, they cannot be separated. The split is only complete when every page of the original belongs to a new document. Assign enclosures such as terms and conditions or a cover letter to one of the invoices. A document is split completely or not at all: while the split is open, the original cannot be validated. Data entered on the original is not carried over to the new documents. Only documents in PDF format can be split. Splitting can only be switched off per document class, not per vendor. Troubleshooting The "Start Splitting" action is greyed out Is Disable Document Splitting switched on for this document class in the Document Class Setup? Is the document in a format other than PDF? Does the document have the status Rejected or Deleted? You undo a rejection with Withdraw document rejection. Is Activated switched on in the Squeeze Setup and is Version (Squeeze Tenant) filled in? Without a connection, the other SQUEEZE actions are greyed out as well. "Finish Splitting" is shown instead of "Start Splitting" A split was started for this document and not finished. Choose Finish Splitting, assign the remaining pages and close the window. If you have not created any new document yet, simply close the window again – the split is then discarded. "Validate" reports "The document is not valid …" If the plausibility entries show The Document is not completely split. Please split all pages., the split is still open. Proceed as in the previous point. On opening, "The Document is not completely split. …" appears and the Squeeze Viewer opens Some pages of the original do not belong to a new document yet. Assign them and close the window. As long as pages are left over, the window opens again after you close it. On opening, "Split complete. This document will be deleted." appears You opened the original of a completed split, for example from the Deleted view. There is nothing left to do here; continue with the new documents. The new documents do not appear In the Squeeze Documents list, choose Download Documents now. Use the Queue action to check whether SQUEEZE is still processing the new documents. The original has disappeared from the list After a completed split, the original has the status Deleted. Switch the Squeeze Documents list to the Deleted view; the Note column shows who split the document. Related topics SQUEEZE Document Validation SQUEEZE Document Overview Document Classes Setup SQUEEZE Setup SQUEEZE Queue Plausibility Checks External Viewer Order & Goods Receipt Reconciliation The purchase order & goods receipt comparison checks the read out document items and compares them with all purchase order & goods receipt lines based on the read out purchase order numbers of the document. You can open the order match at any time with the Order Match action on the SQUEEZE Document Validation page, except for deleted or rejected documents. The match uses the order number that SQUEEZE read from the document or that is entered in the Order No. header field. If the document has no order number, the list stays empty until you select an order in the Order No. field at the top. This comparison is performed automatically after the document has been retrieved from SQUEEZE. The user has the possibility to perform or correct this comparison manually as well. Prerequisites Document class: Documents of the document class Invoice / Credit Memo are matched against purchase orders and receipts. Documents of the document class Order Confirmation are matched against purchase orders only (see Order Confirmations). Vendor: The document has a vendor, and it is the same as the Buy-from Vendor No. of the purchase order. The order match does not show orders and receipts of other vendors. Order number: For the automatic match on import, SQUEEZE must have recognized at least one order number – in the header, as an additional order number or on a line (SQZ Order No.). The header field Order number found shows whether this is the case. In the order match itself you can select any order of the vendor. Open lines: The purchase order has lines that are not fully invoiced yet. To match against receipts, a posted purchase receipt for the order with a Qty. Rcd. Not Invoiced must exist. Setup: Automatic Order Match is filled in (see Setup). To allocate lines to purchase order lines, Allow Order Allocation must be switched on as well. Different units of measure: For 24 PCS to be matched with an order line of 1 PALLET, for example, both units must be set up for the item in Item Units of Measure with their Qty. per Unit of Measure. Permissions: The permission sets DEXPRO SQUEEZE User and DEXPRO SQUEEZE Admin include the order match (see Permission sets). The order match reads purchase orders and posted purchase receipts with the user's own permissions, so the user also needs read access to purchase orders and posted purchase receipts in Business Central. Setup The settings are on the Order Match FastTab of the Document Class Setup (default for all vendors) and of the Vendor Related Setup (exception for individual vendors). If the vendor has a Vendor Related Setup, its values apply to the order match; only Allow Order Allocation always comes from the Document Class Setup. A new Vendor Related Setup takes over the values of the document class when it is created. Field Effect Automatic Order Match What documents are matched against automatically on import: Receipt (lines of posted purchase receipts) or Order (purchase order lines). Blank = no automatic match. Default: Receipt for Invoice / Credit Memo, Order for Order Confirmation. Amount Tolerance %, Max. Amount Tolerance Permitted deviation of the line amount as a percentage or as an amount (see Tolerances). Ignore Amount Tolerance The amount is not checked in the final check. Quantity Tolerance %, Max. Quantity Tolerance Permitted deviation of the quantity as a percentage or as an absolute quantity. Ignore Quantity Tolerance The quantity is not checked in the final check (for the search, see the note under Tolerances). Description Similarity % Minimum similarity of the descriptions for search step 4. Blank or 0 means 70%. The field is hidden; show it with Personalize. Use Description 2 in Order Match Document Class Setup only: in search steps 2 and 3, the automatic match also compares the recognized description with the Description 2 of the order or receipt line, and with their Description and Description 2 combined. Default: off. Replace Data Invoice / Credit Memo only: when a line is applied, its direct unit cost is replaced by that of the order line – or, for a receipt line, by that of the receipt line. With the switch off, the direct unit cost read by SQUEEZE stays, unless it is 0. Description, quantity and line discount % are taken over either way (see 4. Apply). Default: on. Allow Order Allocation Document Class Setup only, shown for Invoice / Credit Memo: permits allocations to purchase order lines. Default: off for Invoice / Credit Memo, on for Order Confirmation. Receipt Date Tolerance, Shipping Time Order confirmations only (Shipping Time only in the Vendor Related Setup), see Order Confirmations. In the Document Class Setup, Automatic Order Match can only be set to Order if Allow Order Allocation is switched on. The Vendor Related Setup does not check this – only choose Order there if the document class allows order allocation. Menu Allocate Assigned lines are represented by a green tick . Allocate This assigns the selected order/delivery line to the selected SQUEEZE document line. Allocating manually does not check any tolerances. If the document line already has an allocation, it is replaced. Order lines (document type Order) can only be allocated if Allow Order Allocation is switched on in the Document Class Setup. Allocate automatically This assigns the appropriate order/delivery line to all SQUEEZE document lines. For this, the order/delivery itself must be selected in the upper area. You can also select several orders/receipts or individual lines in the upper area; for an order or receipt, all of its lines are processed. Only document lines without an allocation are searched, using the same rules as on import (see "How the automatic match works"). Only the order shown in the Order No. field at the top is taken into account. The allocations found are not applied yet – use the actions under Apply for that. Delete allocation Unassigned lines are represented by a red exclamation mark . Delete selected allocation This removes the assignment of the selected line. Delete all allocations This removes all assignments. Deleting an allocation does not undo an earlier apply: type, no., quantity, description and the other values taken over stay on the document line. Apply Apply selected This applies the assignment of the selected line. The document line takes over the data of the allocated order/delivery line, and existing values are overwritten – see "4. Apply" further down for which ones. This also immediately transfers this change to the validation line. Apply all allocated This applies the assignment of all assigned lines. The document lines take over the data of the allocated order/delivery lines, and existing values are overwritten. This will also immediately transfer these changes to the validation lines. Apply all allocated applies every allocation of the document again – including those already applied. Corrections you made to these document lines afterwards (for example to the quantity) are overwritten. Areas Order number The order number currently to be compared is displayed here. If several order numbers have been read out, the corresponding list can be opened via the three dots. The field is pre-filled with the order number from the document header or, if there is none, with the first additional order number SQUEEZE read. The list behind the three dots contains the order number from the header, all additional order numbers read, the order numbers from the lines (SQZ Order No.) and all released purchase orders of the vendor, each with where it comes from. If the number does not belong to a purchase order of the vendor on the document, a red message appears next to it, for example Order No. 106099 does not match the Buy-from Vendor No. 20000. The list below then stays empty. Order & Deliveries In this area the order and its lines that are not yet fully invoiced are listed; for invoices and credit memos also the related deliveries with their lines that are not yet invoiced. Lines without a type (such as text lines), fully invoiced order lines and receipt lines without an open quantity are not shown. The Quantity column shows the open quantity: for order lines the quantity not yet invoiced (quantity minus Quantity Invoiced), for receipt lines the Qty. Rcd. Not Invoiced, for order confirmations the Outstanding Quantity. Quantity (Base) shows the same quantity in the base unit of measure. The Allocated column shows whether a line of this document is allocated to the line. SQUEEZE document lines In this area all read out positions of the SQUEEZE document are listed. The Allocated column shows whether the document line has an allocation; the columns Allocated Document Type, Allocated Document No., Allocated Document Line No., Allocated Quantity, Allocated Unit Price, Allocated Line Amount and Allocated Line Discount % show what it is allocated to. How the automatic match works The automatic match runs when a document is imported, if Automatic Order Match is filled in, and every time you choose Allocate automatically in the order match. The system goes through the open order or receipt lines one by one and looks for a matching document line for each of them. 1. Determining the order and receipt lines On import, every order number of the document is used: the one from the header, the additional ones read by SQUEEZE and those from the lines (SQZ Order No.). Allocate automatically only uses the order in the Order No. field of the order match. On import, only lines of the type set up are used: receipt lines for Receipt, order lines for Order. Allocate automatically uses the lines you selected. The comparison uses the open quantity: for an order line the quantity not yet invoiced, for a receipt line the Qty. Rcd. Not Invoiced. The amount of the order or receipt line is converted to this quantity. 2. Searching for a matching document line Candidates are document lines that have no allocation yet and whose SQZ Order No. is blank or matches the order. For each order or receipt line, the system tries one step after the other: Type and no.: same Type, the No. equals the no. or the Item Reference No. of the order line, and the Quantity is within the quantity tolerance. Same description: the SQZ Description equals the description of the order or receipt line; upper and lower case do not matter. Description contained: the SQZ Description contains the description of the order or receipt line. Recognized values: SQZ Quantity and SQZ Unit Price are within the quantity and amount tolerance, and the SQZ Description is at least as similar to the description of the order or receipt line as set in Description Similarity % (default 70%). The similarity is the number of characters you would have to change, relative to the length of the longer description. If Use Description 2 in Order Match is switched on in the Document Class Setup and the order or receipt line has a Description 2, steps 2 and 3 are run up to three times: first with the description, then with Description and Description 2 combined, and finally with Description 2 on its own. Lines without a Description 2 are unaffected. If several document lines qualify, the top one is taken. If the document line has a different unit of measure than the order or receipt line, steps 1 and 4 first compare via the base unit of measure and only then the values as they stand (see Example 3). 3. Final check Once a step has found a document line, the system checks the Line Amount of the document line against the amount of the order or receipt line for the open quantity (amount tolerance), and the Quantity of the document line against the open quantity (quantity tolerance, also via the base unit of measure). The document line is allocated only if both fit. If the document line found fails the check, the order or receipt line stays without an allocation – the following search steps are not tried for it. Tolerances The final check works the same way for amount and quantity: % value Max. value Permitted deviation 0 0 none – the values must match exactly greater than 0 0 at most the percentage, relative to the value of the document line 0 greater than 0 at most the max. value greater than 0 greater than 0 both limits must be met With Ignore Amount Tolerance or Ignore Quantity Tolerance the respective check is skipped. During the search – quantity in steps 1 and 4, unit price in step 4 – the system only permits a deviation if the % value and the max. value are both greater than 0; the narrower of the two limits then applies. If one of the two values is 0, or Ignore Quantity Tolerance is switched on, the quantity must match exactly there. So if you want to permit deviations, always fill in both values. For the unit price in step 4, the Max. Amount Tolerance is divided by the quantity; with Ignore Amount Tolerance the unit price is not compared there, but the document line then needs an SQZ Unit Price greater than 0. 4. Apply On import, the allocations found are applied right away. Allocate and Allocate automatically only allocate; you apply with Apply selected or Apply all allocated. When applied, a document line of the document class Invoice / Credit Memo takes over from the allocated line: Type, No., Item Reference No., Unit of Measure, posting groups, dimensions, location, bin, deferral code and project details of the order line – for a receipt line, the dimensions of the receipt line, the Description of the order line, as Quantity the open quantity of the allocated line: for an order line the quantity not yet invoiced, for a receipt line the quantity received but not yet invoiced, the Line Discount % of the order line, the Direct Unit Cost only with Replace Data (see Setup). The Line Amount is then recalculated from quantity, direct unit cost and discount. If the document line has a different unit of measure than the allocated line, it is first converted into that unit: 24 PCS at 10.00 become 1 PALLET at 240.00. The Item Match Method column of the lines then shows, for example, Matched by Order Match (Purch. Rcpt. Line: Document No. 107001, Line No. 10000). The column is hidden by default; show it with Personalize. When the purchase invoice is created, document lines allocated to a receipt line are created from that receipt line – as with Get Receipt Lines – and then receive quantity, direct unit cost, line discount % and posting groups from the validation. Order confirmations Only purchase order lines are matched; the comparison uses the Outstanding Quantity. Order lines without an outstanding quantity are not shown. Order lines that have no Promised Receipt Date yet are allocated first, the others afterwards. In steps 2 and 3 the quantity must also be within the quantity tolerance. When applied, the confirmed quantity, the confirmed direct unit cost and the description are kept (converted if the unit of measure differs); type, no., unit of measure, posting groups and dimensions, among others, are taken over. See Order Confirmations for more. Deviations after allocation For each allocated line, the SQUEEZE Document Validation page shows the info boxes Order Match Info (Quantity), Order Match Info (Price) and Order Match Info (Discount), for order confirmations also Order Match Info (Date). Deviations are shown in red: Price: direct unit cost against the allocated unit price, with the amount tolerance; the max. amount tolerance is divided by the quantity for this. Quantity: quantity against the allocated quantity, with the quantity tolerance. Discount: line discount % against the allocated line discount % – without tolerance. If the line is allocated to a receipt line, the system also compares it with the order line; if it is allocated to an order line and a receipt already exists for it, also with the receipt line. The Order Match Activities tiles in the role center count documents with deviations (see Role Center Activities). Allocation log For every order or receipt line, SQUEEZE records what became of it: which document line it was allocated to and what the match recognized it by – or why nothing was allocated. The Allocation of the Line info box shows the entries for the line you selected in the Order & Deliveries area. {add screenshot of Order & Goods Receipt Reconciliation here} Each entry starts with the order or receipt line it is about and then gives the result: Applied – the line was allocated. The sentence names the search step that found it and the values that mattered: the item no. and the quantity, the identical or the contained description, or quantity, unit price and the similarity reached against the similarity required. An allocation made by hand is recorded just as one removed by hand. No Match – nothing was allocated. The sentence names the document line that came closest and, for quantity, unit price and description, whether each one fitted or by how much it was off. If it says no free document line was left, the document simply had no unallocated line any more. Skipped – the line was not looked at at all, because the purchase line is fully invoiced or fully received, or does not exist any more. The same entries – together with those of the other automatic steps – are in the Creation Log of the document, where they can still be read long after the order match has been closed. Examples The examples assume the document class Invoice / Credit Memo with its default values: Automatic Order Match = Receipt, Replace Data on, Allow Order Allocation off, all tolerances 0. Example 1: Invoice for a partial delivery Purchase order 106001 for vendor 20000 has one line: item 1000 "Office chair Comfort", quantity 10, direct unit cost 120.00. Receipt 107001 over 6 pieces has been posted. The invoice states order number 106001 and one line over 6 pieces at 120.00. SQUEEZE recognized item 1000; the description read is "Office chair Comfort black". On import, the system determines receipt line 107001 / 10000 with an open quantity of 6. Step 1 finds the line: type Item, no. 1000, quantity 6. The final check finds no deviation: line amount 720.00 = 6 × 120.00, quantity 6 = 6. The line is allocated and applied. Its description is now "Office chair Comfort", its item match method Matched by Order Match (Purch. Rcpt. Line: Document No. 107001, Line No. 10000). When the purchase invoice is created, the invoice line is created from receipt line 107001 / 10000. If Automatic Order Match were set to Order, the line would be compared with the order line and its quantity not yet invoiced, 10. Without a quantity tolerance, the line over 6 pieces would then not be allocated. Example 2: Price deviation and amount tolerance As example 1, but with Amount Tolerance % = 1 and Max. Amount Tolerance = 5. Both limits must be met: Direct unit cost on the invoice Line amount Deviation from 720.00 Result 120.50 723.00 3.00 (0.41%) allocated 121.00 726.00 6.00 (0.83%) not allocated – more than 5.00, although below 1% In the first case the line has the direct unit cost of the receipt line after applying (120.00, line amount 720.00), because Replace Data is on; with the switch off, 120.50 stays. In the second case the line remains without an allocation. You can allocate it by hand with Allocate in the order match – no tolerances are checked then. Example 3: Different unit of measure Item 70000 "Hexagon bolts M8 galvanized" has the base unit PCS, the unit PACK with a Qty. per Unit of Measure of 2 and the unit PALLET with a Qty. per Unit of Measure of 24. 1 PALLET at 240.00 was ordered and received. The vendor invoices 24 PCS at 10.00. Step 1 converts via the base unit: 1 PALLET = 24 PCS – the quantity fits. Final check: line amount 240.00 = 240.00; quantity 24 PCS = 1 PALLET. When applied, the line is converted into the unit of the receipt line: 1 PALLET at 240.00, line amount still 240.00. Because the conversion is checked first, an order line over 1 PALLET goes to an invoice line over 1 PALLET and not to a line over 1 PACK of the same item, even though both have the quantity 1. Example 4: Line without a recognized item As example 3, but SQUEEZE did not recognize an item on the line. It read SQZ Description "Hexagon bolts M8 galv.", SQZ Quantity 24 and SQZ Unit Price 10.00. Step 1 finds nothing because the line has no item. Steps 2 and 3 find nothing because the description of the receipt line, "Hexagon bolts M8 galvanized", is neither equal to nor contained in the SQZ description. Step 4: SQZ quantity 24 corresponds to 1 PALLET, SQZ unit price 10.00 corresponds to 240.00 per PALLET, and the descriptions are about 78% similar (6 changed characters out of 27) – more than the required 70%. Check and apply as in example 3. The line gets type Item and no. 70000. Limitations The automatic match on import runs only once per document. If a receipt is posted later or an order number is added afterwards, open the order match, choose Allocate automatically and then Apply all allocated. On import, documents are matched against one type only: receipt lines or order lines. Receipts are only shown for invoices and credit memos. Lines whose SQZ Order No. refers to a different order are not allocated to this order automatically. Steps 2 and 3 compare the description only. If the first document line found fails the final check, the system does not look for another document line for this order or receipt line. Allocating manually checks neither tolerances nor open quantities. The system does not prevent an order or receipt line from being allocated to several document lines – by hand, for example, or when you run Allocate automatically again. When the purchase invoice is created, however, only one invoice line is created per receipt line. Check the Allocated column before validating. Deleting an allocation does not undo the apply. When applied, an invoice line replaces quantity, description and line discount % with the values of the allocated line. If the vendor invoices only part of a receipt or order line, correct the quantity after applying. Troubleshooting No line was allocated on import Is Automatic Order Match filled in – in the Vendor Related Setup if the vendor has one, otherwise in the Document Class Setup? Did SQUEEZE recognize an order number (field Order number found)? If not, select the order in the order match and use Allocate automatically. Does the order belong to the vendor of the document? Otherwise the order match shows a red message next to the order no. Are there open lines of the type set up? For Receipt, the receipt must be posted and not yet invoiced. If it was posted after the import, run Allocate automatically by hand. Are quantity and line amount within the tolerances? With the default values of 0 they must match exactly. If only one of the two tolerance values is filled in, the search by type and no. only finds identical quantities (see Tolerances). Does the SQZ Order No. of the line refer to a different order? Error about "Allow Order Allocation" when allocating You allocated an order line or ran Allocate automatically on an order, but Allow Order Allocation is switched off in the Document Class Setup – the default for Invoice / Credit Memo. Select the receipt or its lines instead, or switch on Allow Order Allocation. Note that when the order match opens, the first row is selected – and that is the order. The plausibility check reports "Allocated Document Type cannot be Order." A line is allocated to an order line although Allow Order Allocation is switched off. Delete the allocation and allocate the line to the matching receipt line, or switch on Allow Order Allocation. "Order No. … does not match the Buy-from Vendor No. …" next to the order number There is no purchase order with this number for the vendor on the document. Check the vendor in the document header and select the order number via the three dots. After applying, the line has a different quantity or description This is the result of applying (see 4. Apply). Correct the values by hand afterwards and do not run Apply all allocated again – otherwise your corrections are overwritten again. "Allow Order Allocation" cannot be switched off The message Automatic Order Match cannot be Order. Please change the value of the Automatic Order Match. appears. First set Automatic Order Match to Receipt or blank. Related topics Import Order / Goods Receipt Lines SQUEEZE Document Validation Document Classes Setup Vendor Related Setup Order Confirmations Role Center Activities Autocomplete Implementation of a user-defined, automatic order reconciliation (for developers) Import Order / Goods Receipt Lines Get items from purchase order / goods receipt Menu Add to import preview This transfers all selected lines to the import preview. Selected lines are represented by a green check mark . Delete selected preview line This removes all selected lines from the import preview. Apply preview This transfers all lines from the import preview to the document to be validated. You have the choice whether these lines should replace the SQUEEZE positions or be appended at the end. Areas Order number The order number read out is displayed here. If several order numbers have been read out, the corresponding list can be opened via the three dots. Order & Deliveries In this area the order and all its lines are listed, as well as all related deliveries and their lines. Import preview All selected items are listed in this area. External Viewer To simplify working with the Viewer, the embedded Viewer can be undocked and thus used on a second screen. All viewer functions, such as highlighting of header and position data, as well as the viewer's training functions are still supported. To ensure that the undocked viewer remains active and updates itself automatically when a document is changed, the "Use external viewer only" field must be set in the user-specific setup. Upload Documents SQUEEZE for BC offers the ability to send documents directly from Business Central to the connected SQUEEZE system. Upload Documents via the Document Overview In the SQUEEZE Document Overview, the Upload documents action is available. When invoked, you will be prompted to select the document class. The upload page then opens. Squeeze File Upload On the upload page, files can be dropped into the drop zone via drag & drop. Multiple files can be dropped simultaneously. The Upload files action uploads all dropped files to the SQUEEZE tenant. After a successful upload, each file is marked with a checkmark. When closing the page, it checks whether all dropped files have been uploaded. If at least one file was not uploaded, a corresponding warning is displayed. SQUEEZE Queue The SQUEEZE Queue provides a real-time overview of the processing status of all documents in the SQUEEZE pipeline of the connected tenant. Overview The queue displays the number of documents at each processing step: Error: Documents where an error has occurred (highlighted in red). The drilldown opens the SQUEEZE web interface. Init Process: Documents in the initial processing step. Image Optimization: Documents currently being pre-processed for image quality. Barcode Extraction: Documents where barcodes are being read. OCR: Documents where text recognition is being performed. Classification: Documents being assigned to a document class. Extraction: Documents where data extraction (document reading) is being performed. Export: Documents ready to be fetched by Business Central. Backup: Already processed documents. Non-empty steps are displayed in bold. The view refreshes automatically every 5 seconds. Actions Download Documents now: Triggers a manual document download from SQUEEZE. Upload document: Allows uploading a document to the SQUEEZE system. The queue is accessible from the SQUEEZE Document Overview via the Queue action. Viewer in Target Document The SQUEEZE Viewer can also be displayed in the resulting target documents (Purchase Invoices and Purchase Orders). This allows users to view the originally scanned document at any time without having to navigate back to the SQUEEZE document. Activation The feature is enabled in the SQUEEZE Setup in the Viewer FastTab via the Viewer in Target Document toggle. How it works When the feature is enabled, the SQUEEZE Viewer appears as a FactBox on the following pages: Purchase Invoice: The viewer displays the originally scanned document from which the invoice was created. Purchase Order: For order confirmations, the viewer displays the associated scanned document. The viewer supports all standard functions, such as highlighting field locations. Detached mode is also supported. Note The link between the target document and the SQUEEZE document is established automatically via DEXPRO Core. The viewer is only displayed if a corresponding SQUEEZE document exists for the respective purchase document. Plausibility Checks Plausibility checking is a central component of document validation. It ensures that all relevant data is plausible and complete before a document is processed further. The results are displayed in the Plausibility Entries info box. Header Field Checks Vendor exists / not blocked: The specified vendor must exist in the system and must not be blocked (optionally: blocked status "Payment" can be skipped via "Ignore Vendor Blocked (Payment)" in the Document Class Setup). Mandatory fields: Document Date, Posting Date, Document Reference, and Document Type must be filled in. Posting Date: The posting date must fall within an allowed posting period (can be disabled via "Disable Posting Date Check"). IBAN check: If an IBAN was recognized, the system checks whether a matching bank account is stored for the vendor (can be disabled via "Disable IBAN Check"). VAT Reg. No. check: If a VAT registration number was recognized, the system checks whether it matches the vendor's stored VAT registration number (can be disabled via "Disable VAT Reg. No Check"). Duplicate check: The system checks whether a document with the same reference number and vendor already exists. Currency Code: The specified currency code must exist in the system. Payment Terms Code: A specified payment terms code must exist in the system. Responsibility Center (invoices and credit memos): The responsibility center must exist in the system, and your user must be allowed to use it on purchase documents. If the user setup (or the company information) restricts your user to another responsibility center, an entry such as Responsibility Center BERLIN is not allowed. Your user is set up to process purchases from Responsibility Center MUENCHEN only. appears. VAT Bus. Posting Group (invoices and credit memos): The VAT business posting group in the document header must exist in the system. Order Number: If an order number is specified, the corresponding order must exist in the system. Amount Checks Four checks compare the amounts of the document with each other. Except for the VAT difference described below, they all measure against the payment tolerance of the General Ledger Setup, that is against the fields Payment Tolerance % and Max. Payment Tolerance Amount. Header Amount Check: Net Amount 1 to 3 plus Tax Amount 1 to 3 are compared with the Total Amount of the header (can be disabled via "Disable Header Check"). Line Amount Comparison: Net Amount 1 to 3 of the header are compared with the sum of the line amounts (can be disabled via "Disable Line Comparision"). A small difference can be settled on a difference account beforehand, see Document Classes Setup. Header Tax Check: For each of the three tax rates, the system checks that tax amount and tax rate are both filled in and that the tax amount matches the net amount times the tax rate (can be disabled via "Disable Header Tax Check"). This check measures against the maximum allowed VAT difference, see VAT difference. Gross Amount Check: The sum of the Amount Including VAT of the lines is compared with the Total Amount of the header (can be disabled via "Disable Gross Amount Check"). The other checks do not cover it: the header amount check and the line amount comparison work with the tax amounts of the header, whereas the gross amount of a line carries the tax its own VAT posting setup produces, rounded per line. The cents of that line by line rounding show here and nowhere else. The Disable Amounts Check switch turns all four checks off at once; switching it off turns all four on again. Each of them can also be switched on and off on its own. VAT difference A tax amount printed on the document that differs from net amount times tax rate is not necessarily an error: the vendor adds up the tax of the whole document and rounds once, Business Central computes it per line and rounds per line. SQUEEZE follows the standard here. If Allow VAT Difference is set in the Purchases & Payables Setup, a deviation up to Max. VAT Difference Allowed of the General Ledger Setup – or of the currency, for a document in a foreign currency – is kept as a VAT difference instead of being reported as a plausibility entry. The same applies to the cents of the line by line VAT rounding that show in the gross amount check. The cents accepted this way are not lost: when the purchase document is created, the recognized tax amount of each rate replaces the calculated one, exactly as a user does on the statistics page. The posted document therefore matches the vendor's document to the cent. What was carried over and what was not is recorded in the Creation Log. If Allow VAT Difference is not set, or the deviation is larger than allowed, it is reported as a plausibility entry; the entry then leads to the Purchases & Payables Setup or to the General Ledger Setup. Line Checks Posting Groups: For each line, the system checks whether the required VAT posting groups and general posting groups exist. Items: If an item is assigned, it must exist in the system. Unit of Measure: The specified unit of measure must be valid for the assigned item. Location Code: If a location code is specified, it must exist (can be disabled via "Disable Location Code Check"). Dimensions: Dimension values in header and lines are checked for validity. Project data: If project data (Project No., Project Task No.) is assigned, their existence and validity are checked. Configuration Individual plausibility checks can be disabled in the Document Classes Setup under the Plausibility Check section. This allows you to adapt the validation to your specific business processes. Order Confirmations In addition to purchase invoices and credit memos, SQUEEZE for BC also supports the processing of Order Confirmations. This document class enables automated capture of incoming order confirmations from vendors and reconciliation with existing purchase orders. Processing Order confirmations go through the same processing workflow as invoices (SQUEEZE extraction, import, validation). The following specifics apply: Mandatory order allocation: Unlike invoices, order confirmations require at least one line to be allocated to an order line before validation can be completed. Promised Receipt Date: The delivery date confirmed by the vendor is captured at line level and adopted as "Promised Receipt Date". No goods receipt matching: Order confirmations can only be matched against orders, not against goods receipts (posted receipts). Order Matching for Order Confirmations Order matching for order confirmations additionally checks the following conditions: The promised receipt date must not be empty. The confirmed quantity and unit price must not be zero. Deviations between confirmed and ordered values (quantity, price, discount, delivery date) are highlighted in the order match info boxes. Tolerances Unlike invoices, order confirmations additionally provide the Receipt Date Tolerance setting in the Document Class Setup and the Vendor Related Setup. This defines as a date formula how far the confirmed delivery date may deviate from the expected date (e.g. 2D for two days). Setup To process order confirmations, a separate document class of type Order Confirmation must be set up in SQUEEZE and in the Document Classes Setup in Business Central. Autocomplete Autocomplete remembers how you assigned the lines of a vendor and fills in the same lines on that vendor's next documents by itself: type, no., unit of measure, description and dimensions. This saves the most work on recurring invoices without a purchase order – rent, maintenance contracts, energy or office supplies, for example. The feature learns only from your own validations. There are no rules to maintain up front: a line is filled in automatically only after you have corrected it once for this vendor and validated the document. Prerequisites Option switched on: in the Document Class Setup, FastTab Squeeze, the field Autocomplete Option is set to Manual or Automatic. If the vendor has a Vendor Related Setup, its value applies (see below). Vendor known: the document has a Vendor No. Everything autocomplete remembers is stored per vendor. Without a vendor nothing is remembered and nothing is filled in. At least one validation: an earlier document of the same vendor and document class was validated after the line on it had been corrected. On a vendor's very first document there is nothing to fill in yet. For filling in automatically on import: the document has no Order No. Documents with an order number are handled by the order match; you can still run the Autocomplete action on them by hand. Permissions: the permission sets DEXPRO SQUEEZE User and DEXPRO SQUEEZE Admin contain everything autocomplete and the list of entries need. See Permission sets. Setup Autocomplete Option The field exists in the Document Class Setup (the default for all vendors) and in the Vendor Related Setup (an exception for individual vendors). Option "Autocomplete" action Filled in on import Remembered on validation Never hidden no no Manual shown no yes Automatic shown yes yes Manual is a good way to start: the system already learns, but you decide per document whether to take over the remembered values. Once the suggestions fit reliably, switch to Automatic. Document class or vendor – which applies? If the vendor has a Vendor Related Setup, its Autocomplete Option applies – to the action, to filling in on import and to remembering on validation. Otherwise the option of the Document Class Setup applies. This lets you deviate for individual vendors in both directions: if the document class is set to Manual, set the vendor with the monthly rent invoices to Automatic, for example; if it is set to Automatic, take a vendor with constantly changing lines out with Manual or Never. A new Vendor Related Setup takes over the Autocomplete Option of the document class. If you change the document class afterwards, the vendor keeps its value. How it works 1. Remembering on validation When you finish a document with Validate (or automatic validation finishes it), the system creates an autocomplete entry for each line, or updates the existing one, if the line has a No. (item, G/L account, resource and so on), and the line was changed after the import – in practice, your corrections. It remembers the line's Type, No., Unit of Measure, Description and dimensions – per document class and vendor. If an entry for the same line already exists, it is overwritten with your latest correction. Quantities and prices are not remembered. 2. Recognising a line How a line is recognised depends on where it comes from: Lines read from the document: by the combination of the values SQUEEZE read – SQZ Item No., SQZ Unit of Measure, SQZ Description and SQZ Unit Price. All four must match exactly; upper and lower case do not matter. Lines from the account assignment setup: by the type and no. of the account the account assignment setup inserts. For these lines the system remembers the description and the dimensions per vendor and account. The account itself stays the one of the account assignment setup – to use a different account, set it in the vendor's account assignment setup or with a line account assignment rule. Because the unit price is part of the recognition, a line counts as new after a price change. You correct it once by hand; after validation the new price is recognised too. 3. Filling in On every recognised line the system sets Type and No. – with everything Business Central derives from them, such as posting groups and default dimensions – and the Unit of Measure. Description and dimensions are only taken over if the entry has any; an entry without a description or without dimensions leaves the existing values alone. Quantity and prices are not changed. Automatic: when the document is imported, before the order match and the account assignment. Lines that the account assignment setup inserts afterwards are filled in right after that, too. Manual: with the Autocomplete action on the SQUEEZE Document Validation page. The action processes all lines of the document. The Autocomplete action overwrites type, no. and unit of measure on every recognised line, plus description and dimensions if remembered – even if you have already changed the line by hand. Run the action before making your own corrections. The Item Match Method column of the lines shows which lines were filled in: Matched by SQZ Autocomplete Entry (previous manual assignment for this vendor). The column is hidden by default; show it with Personalize. Order of steps on import Autocomplete (only with option Automatic and without an order no.) Automatic order match Account assignment via the account assignment setup (only without an order reference), followed by autocomplete of the new lines Line account assignment rules Automatic validation, if enabled Line account assignment rules run after autocomplete. If a rule applies to a line, the rule's account wins. Examples Example 1: Recurring line without an item card An office supplier (vendor 44000) sends an invoice every month with the line: SQZ Item No. SQZ Description SQZ Unit of Measure SQZ Unit Price TON-505 Toner black 05A PCS 89.90 January: the line arrives without a no. You set type G/L Account, no. 6815 (office supplies), the description "Toner printer reception" and the cost centre ADMIN. Then you validate the document – the system remembers the line for vendor 44000. February: the same line arrives again. With option Automatic it is already filled in with G/L account 6815, the description and the cost centre when you open the document; with Manual you choose Autocomplete. June: the supplier raises the price to 92.50. The line is not recognised and arrives empty. You assign it once more and validate – from July on the new price is recognised as well. Example 2: Dimensions on a line from the account assignment setup For an energy supplier, an account assignment setup is set up that inserts one line per VAT rate with G/L account 6325 and the description "Energy costs". On the first invoice you change the description to "Electricity hall 2", set the cost centre PRODUCTION and validate. On every further invoice of this vendor the account assignment setup again inserts a line with G/L account 6325, and autocomplete adds "Electricity hall 2" and the cost centre PRODUCTION. Autocomplete Entries The Autocomplete Entries list shows what the system has learned. Open it with the search, or from the Squeeze Vendor Related Setups list with the Autocomplete Entries action – the list is then already filtered to the selected vendor and its document class. Document Class and Vendor No. — which documents the entry applies to. Type, No., Description, Unit of Measure — the values the line is filled in with. Dimension Set ID and Shortcut Dimension 1–8 Code — the dimensions. Use the Dimension Set ID to open the dimensions and change them. Which read line an entry belongs to is stored internally as a check value and is not shown in the list. Identify an entry by its vendor, no. and description instead. New entries are only created by validating; entries created by hand are never recognised. You can change entries – for example enter a different G/L account or cost centre – or delete a wrong entry. What the creation log says Every run of Autocomplete writes its decisions into the Creation Log of the document. That answers the two questions that otherwise stay open: why was nothing filled in – and what exactly was filled in? If Autocomplete did not run, the reason is there: the option is not set to Automatic (naming the option that actually applies), the document refers to an order whose order lines decide the accounts, or the document has no lines. If something was filled in, there is one entry per line: what the line was recognized by – the recognized item no., unit of measure, description and unit price, or, for a line from the account assignment setup, the type and no. of the account assignment line – and what it was given: type and no., unit of measure, description and dimensions. A closing entry says how many lines were completed in total. If no remembered entry fitted any line, that is recorded as an entry of its own with the result No Match. That is a different answer from "Skipped": the setup is in order, nothing had simply been learned that fitted. When Autocomplete runs a second time because the account assignment code has added lines, the entries say so; the Source column then holds the account assignment code, so the two runs can be told apart and filtered on. Limitations Only an identical line is recognised: if the item number, the spelling of the description, the unit of measure or the unit price on the document changes, it counts as new. Entries apply only to the vendor and the document class they were learned for. On import, lines are filled in automatically only on documents without an order no. Filling in does not check whether the remembered item or account has been blocked in the meantime. When you block or delete an item or account, delete the entries that refer to it as well. Troubleshooting The "Autocomplete" action is missing The option in the vendor's Vendor Related Setup is set to Never – or there is none and the document class is set to Never. Nothing is filled in on import Does the vendor have a Vendor Related Setup? Then it must be set to Automatic – the document class does not matter then. If it has none, the document class must be set to Automatic. Manual never fills in on import. Does the document have an Order No.? Then nothing is filled in on import; run the action by hand. Is there an entry? Open the Autocomplete Entries filtered to the vendor. Is the line really identical? Compare SQZ Item No., SQZ Description, SQZ Unit of Measure and SQZ Unit Price with the document it was learned from – most often the price has changed. Does a line account assignment rule apply? It runs afterwards and sets its own account. A wrong value keeps being filled in Correct the line on the next document and validate it – the entry is overwritten with your correction. Or change or delete the entry in the Autocomplete Entries. Related topics Document Classes Setup Vendor Related Setup Account Assignment Setup Selecting account assignments based on conditions SQUEEZE Document Validation Creation Log The Creation Log shows how a document came about: what the automatic steps of SQUEEZE did while it was created and validated – and what they did not do, and why. It answers the questions that otherwise stay open: why is this line still empty? Why was the document not validated automatically? Where does this extra line come from? The log records the automatic steps, not the changes a user makes to the document afterwards. It is the story of how the document came to be, not a change log. Where to find it On the SQUEEZE Document Validation page, with the Creation Log action on the ribbon. In Core Documents, with the Creation Log action. It is only enabled when there are entries for the document. In the Order & Goods Receipt Reconciliation as the Allocation of the Line info box next to the selected order or receipt line. It shows only the Order Match entries for that line. {add screenshot of Creation Log here} Which steps are recorded Every automatic step writes an entry once it has decided something – including when it decided to do nothing. Step What is recorded Autocomplete Whether Autocomplete ran, per line what the line was recognized by and what it was given, and at the end how many lines it was applied to. If it did not run, the reason is there: the option is not set to Automatic, the document refers to an order, or the document has no lines. Account Assignment Code Which account assignment code was used and where it came from: a rule, the Vendor Related Setup or the Document Class Setup – or that none applies. Line Account Assignment Per line, which line account assignment rule set the type and account no., or why none did: no rule group set up, no rule matched, or the line is allocated to an order or receipt line and takes its account from there. Automatic Order Match Whether the automatic match ran on import and how many lines it allocated – or why it did not run: not activated, no order number on the document, or an extension handled it. Order Match Per order or receipt line, what became of it: which document line it was allocated to and by which criterion, or why it was not – naming the values that decided it. See Order & Goods Receipt Reconciliation. Difference Whether a small difference between the net amounts of the header and the sum of the line amounts was settled on the Difference Account – or that it was larger than the Max. Difference Amount and was left as it was. VAT Difference Which deviation between the printed and the calculated tax amount was accepted as a VAT difference, and, when the purchase document is created, which recognized tax amount was carried into it – or why it was not: the deviation is too large, or the tax rate occurs more than once on the purchase document. Automatic Validation Whether the document was validated automatically, or why not: it is not plausible yet, or an extension handled the validation. Validation by a user is recorded as well. Next Process Step Which next process step applies and what decided it: a rule of the rule group, or the Document Class Setup. Reading an entry The list is in chronological order, oldest entry first. You can filter it as usual – on a step, for example, or on a line number. Logged At – when the step was processed. Step – which automatic step the entry is about. Result – what became of the step (see below). Reason – why the step decided as it did, in one sentence and with the values it turned on. Line No. – the document line the entry is about, where the step decided per line. Empty for entries about the document as a whole. Source – the rule or setup the step followed, such as the rule code, the account assignment code or the number of the order. Logged By – the user the step ran as. For documents retrieved by the queue this is the user of the job queue entry. Result The Result field is coloured so the list can be skimmed: applied in green, failed in red, skipped and no match in yellow. Applied – the step ran and changed something. Skipped – the step did not run at all. The reason names the setting or condition that stopped it. No Match – the step ran but found nothing to do. That is a different answer from "Skipped": the setup is in order, nothing simply fitted. Failed – the step could not be carried through. Examples This is what the entries look like in practice: Autocomplete, Applied: Line 10000, recognized by the recognized item no., unit of measure, description and unit price: type G/L Account and no. 6815, the description "Telephone costs", the dimensions. Automatic Order Match, Skipped: The automatic order match did not run: it is not activated for the vendor or the document class. Order Match, No Match: Order 106001 line 10000: nothing allocated. The closest was line 20000 - quantity: fits, unit price: 12.50 against 11.90, outside the tolerance, description: 64% of the 70% needed. Difference, Applied: A difference of 0.02 between the net amounts of the header and the lines was put on account 9900, within the maximum difference amount of 0.05. VAT Difference, Applied: The gross amount of the lines is 0.01 away from the total amount of the document, the tax the lines round differently from the vendor. The difference is kept as a VAT difference: it stays within the maximum allowed VAT difference of 0.05. Automatic Validation, Skipped: The automatic validation did not run: the document is not plausible yet. How long the entries live The entries belong to the SQUEEZE document and to the Core document at the same time. When a validated SQUEEZE document is handed over to the target document and set to the status Deleted, its entries stay and remain visible from the Core document. When a SQUEEZE document is deleted without ever having become a Core document, its entries go with it. Limitations What is recorded are the automatic steps, not every change to the document. Who changed which field and when is a question for the Business Central Change Log. The plausibility check runs again on almost every field change. The steps that hang off it – Difference and VAT Difference – therefore write the same sentence only once; when the amounts change, a new entry with the new figures is added. Entries cannot be edited, and they cannot be deleted one by one. An entry that cannot be written is dropped silently – the log never holds up the processing of a document. Related topics Plausibility Checks Order & Goods Receipt Reconciliation Autocomplete Account Assignment Setup Extension Development This chapter lists important integration events and examples that help in developing an extension for SQUEEZE for BC. Important: Customizations may only be performed by appropriately trained consultants/developers. Furthermore, these are always outside of the standard support. Modify Squeeze origin attachment Overview The  OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment integration event allows third-party developers to customize document attachment records before they are modified during the SQUEEZE attachment processing workflow. An origin attachment is the relevant attachment that leads to the creation of a document (e.g. the vendor´s invoice). Event Declaration [IntegrationEvent(false, false)] local procedure OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment(var DocumentAttachment: Record "DXP Document Attachment") begin end; Event Parameters Parameter Type Description DocumentAttachment Record "DXP Document Attachment" (var) The document attachment record that is about to be modified. Passed by reference, allowing modifications. When This Event is Triggered This event is fired during the  SaveAttachments procedure when: An attachment is being processed from SQUEEZE The attachment is identified as an origin file ( IsOriginFile = true) The system has set the origin file name and  DXP Is Origin File flag Just before the  DocumentAttachment.Modify(true) call Use Cases This integration event is useful for: Custom Field Population: Setting additional custom fields on the document attachment File Name Transformation: Applying custom naming conventions or formatting Metadata Enhancement: Adding custom metadata or tags to attachments Validation Logic: Implementing custom validation before the record is saved Integration Requirements: Preparing data for external system integrations Implementation Example Change The Filename Before Modify [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment', '', false, false)] local procedure OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment(var DocumentAttachment: Record "DXP Document Attachment") var CoreDocument: Record "DXP Document"; SQZDocumentHeader: Record "DXP SQZ Document Header"; Vendor: Record Vendor; NewFileName: Text[250]; VendorPrefix: Text[50]; begin // Get the core document using the document attachment's Document No. if not CoreDocument.Get(DocumentAttachment."Document No.") then exit; // Check if the core document has a linked SQUEEZE document if IsNullGuid(CoreDocument."Linked-to Record Id") then exit; // Get the SQZ Document Header using the SystemId from Linked-to Record Id if not GetSQZDocumentHeaderFromRecordId(CoreDocument."Linked-to Record Id", SQZDocumentHeader) then exit; // Check if Buy-from Vendor No. is populated if SQZDocumentHeader."Buy-from Vendor No." = '' then exit; // Get the vendor record if not Vendor.Get(SQZDocumentHeader."Buy-from Vendor No.") then exit; // Create vendor prefix from Search Name (fallback to Name if Search Name is empty) if Vendor."Search Name" <> '' then VendorPrefix := Vendor."Search Name" else VendorPrefix := Vendor.Name; // Clean the vendor prefix (remove invalid filename characters and limit length) VendorPrefix := CleanFilenameText(VendorPrefix, 30); // Check if vendor prefix already exists in filename to avoid duplicates if DocumentAttachment."File Name".StartsWith(VendorPrefix + '_') then exit; // Create new filename with vendor prefix NewFileName := VendorPrefix + '_' + DocumentAttachment."File Name"; // Update the attachment filename DocumentAttachment."File Name" := NewFileName; end; local procedure GetSQZDocumentHeaderFromRecordId(LinkedRecordId: Guid; var SQZDocumentHeader: Record "DXP SQZ Document Header"): Boolean var RecRef: RecordRef; SystemIdFieldRef: FieldRef; begin // Method 1: Try to get the record directly if LinkedRecordId is actually a SystemId if SQZDocumentHeader.GetBySystemId(LinkedRecordId) then exit(true); // Method 2: If that fails, we need to find the record another way // This assumes the Linked-to Record Id might be stored differently SQZDocumentHeader.Reset(); SQZDocumentHeader.SetRange(SystemId, LinkedRecordId); exit(SQZDocumentHeader.FindFirst()); end; local procedure CleanFilenameText(InputText: Text; MaxLength: Integer): Text var CleanText: Text; begin // Remove invalid filename characters CleanText := DelChr(InputText, '=', '<>|"/\:*?'); // Replace spaces with underscores for better filename compatibility CleanText := CleanText.Replace(' ', '_'); // Limit length CleanText := CopyStr(CleanText, 1, MaxLength); exit(CleanText); end; Important Considerations Data Integrity The  DocumentAttachment record is passed by reference, so any changes will be persisted Consider field length limitations when modifying text fields Performance Keep processing lightweight as this event is called for each origin file attachment Consider caching frequently accessed data Error Handling Implement proper error handling to prevent the attachment save process from failing Use try-functions for risky operations Related Events OnAfterSaveAttachment: Triggered after each attachment is completely saved Consider using this alternative event if you need to perform actions after the record is saved Troubleshooting If your event subscriber isn’t being triggered: Test with origin files specifically (non-origin files won’t trigger this event)     Alternative use of the SQUEEZE attachments The following briefly explains how the attachments downloaded by SQUEEZE for BC can be used for a scenario that differs from the intended use. After creating the purchase document from the validated SQUEEZE document, you have the option of accessing the attachments ( assuming they have been downloaded in advance). // Set IsHandled to true and implement your code // Do not forget to deactivate "Transfer attachments to target document" in the Document Class Setup [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Mgt.", 'OnBeforeTransferCoreAttachmentsToStandardDocument', '', false, false)] local procedure DXPDocMgtOnBeforeTransferCoreAttachmentsToStandardDocument(Document: Record "DXP Document"; var IsHandled: Boolean) begin IsHandled := true; HandleCoreAttachmentsAccordingToYourNeeds(Document, IsHandled); end; procedure HandleCoreAttachmentsAccordingToYourNeeds(Document: Record "DXP Document"; var IsHandled: Boolean) var CoreAttachments: Record "DXP Document Attachment"; InStr: InStream; begin CoreAttachments.SetRange("Document No.", Document."No."); CoreAttachments.IsEmpty() then exit; CoreAttachments.FindSet(); repeat CoreAttachments.Calcfields(Attachment); CoreAttachments.Attachment.CreateInStream(InStr); // Here you can handle the file stream according to your needs [...] until CoreAttachments.Next() = 0; end; Adjustment of attachment file names after validation Overview This guide shows how developers can customize the file names of attachments in DEXPRO SQUEEZE. The OnBeforeAddLineToDocumentJObj event is executed after the plausibility check, ensuring that all document data is fully validated and available. Available Event OnBeforeAddLineToDocumentJObj For invoices/credit notes:  Codeunit 70954657 "DXP SQZ P. Inv/Crdt Memo Impl." For orderconfirmations:  Codeunit 70954658 "DXP SQZ P. Order Conf. Impl." When accessed: After header processing, before line processing, after plausibility check Implementation examples Example 1: Simple vendor prefix for invoices/credit notes codeunit 50100 "Custom Invoice Filename" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure OnBeforeAddLineToDocumentJObjInvoice(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin CustomizeAttachmentFilenames(DocHeader); end; local procedure CustomizeAttachmentFilenames(DocHeader: Record "DXP SQZ Document Header") var DocumentAttachment: Record "DXP Document Attachment"; VendorPrefix: Text; NewFileName: Text[1024]; begin // Beenden, wenn keine Kreditorinformationen vorhanden if DocHeader."Buy-from Vendor No." = '' then exit; // Kreditorenprefix erstellen VendorPrefix := DocHeader."Buy-from Vendor No." + '_'; // Alle Anhänge für dieses Dokument bearbeiten DocumentAttachment.Reset(); DocumentAttachment.SetRange("Document No.", DocHeader."Core Document No."); if DocumentAttachment.FindSet(true) then repeat // Überspringen, wenn Prefix bereits vorhanden if not DocumentAttachment."File Name".Contains(VendorPrefix) then begin // Neuen Dateinamen mit Prefix erstellen NewFileName := VendorPrefix + DocumentAttachment."File Name"; // Aktualisieren DocumentAttachment."File Name" := CopyStr(NewFileName, 1, MaxStrLen(DocumentAttachment."File Name")); DocumentAttachment.Modify(true); end; until DocumentAttachment.Next() = 0; end; } Example 2: Order confirmations - vendor prefix codeunit 50101 "Custom Order Conf Filename" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Order Conf. Impl.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure OnBeforeAddLineToDocumentJObjOrderConf(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin CustomizeAttachmentFilenames(DocHeader); end; local procedure CustomizeAttachmentFilenames(DocHeader: Record "DXP SQZ Document Header") var DocumentAttachment: Record "DXP Document Attachment"; VendorPrefix: Text; NewFileName: Text[1024]; begin // Beenden, wenn keine Kreditorinformationen vorhanden if DocHeader."Buy-from Vendor No." = '' then exit; // Kreditorenprefix erstellen VendorPrefix := DocHeader."Buy-from Vendor No." + '_'; // Alle Anhänge für dieses Dokument bearbeiten DocumentAttachment.Reset(); DocumentAttachment.SetRange("Document No.", DocHeader."Core Document No."); if DocumentAttachment.FindSet(true) then repeat // Überspringen, wenn Prefix bereits vorhanden if not DocumentAttachment."File Name".Contains(VendorPrefix) then begin // Neuen Dateinamen mit Prefix erstellen NewFileName := VendorPrefix + DocumentAttachment."File Name"; // Aktualisieren DocumentAttachment."File Name" := CopyStr(NewFileName, 1, MaxStrLen(DocumentAttachment."File Name")); DocumentAttachment.Modify(true); end; until DocumentAttachment.Next() = 0; end; } Example 3: Both document types - Different prefixes for source files codeunit 50102 "Advanced Filename Handling" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure OnBeforeAddLineToDocumentJObjInvoice(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin CustomizeFilenamesWithSourceHandling(DocHeader); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Order Conf. Impl.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure OnBeforeAddLineToDocumentJObjOrderConf(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin CustomizeFilenamesWithSourceHandling(DocHeader); end; local procedure CustomizeAttachmentFilenames(DocHeader: Record "DXP SQZ Document Header") var DocumentAttachment: Record "DXP Document Attachment"; VendorPrefix: Text; NewFileName: Text[1024]; begin // Beenden, wenn keine Kreditorinformationen vorhanden if DocHeader."Buy-from Vendor No." = '' then exit; // Kreditorenprefix erstellen VendorPrefix := DocHeader."Buy-from Vendor No." + '_'; // Alle Anhänge für dieses Dokument bearbeiten DocumentAttachment.Reset(); DocumentAttachment.SetRange("Document No.", DocHeader."Core Document No."); if DocumentAttachment.FindSet(true) then repeat // Überspringen, wenn Prefix bereits vorhanden if not DocumentAttachment."File Name".Contains(VendorPrefix) then begin // Neuen Dateinamen mit Prefix erstellen NewFileName := VendorPrefix + DocumentAttachment."File Name"; // Aktualisieren DocumentAttachment."File Name" := CopyStr(NewFileName, 1, MaxStrLen(DocumentAttachment."File Name")); DocumentAttachment.Modify(true); end; until DocumentAttachment.Next() = 0; end; } Practical information Available data at the time of the event: DocHeader."Buy-from Vendor No." - Kreditorennummer (validiert) DocHeader."Document Date" - Belegdatum DocHeader."Document Reference" - Belegnummer DocHeader."Core Document No." - Verknüpfung zu Anhängen Alle anderen Belegfelder sind verfügbar Example results: Original:  "Rechnung_2024_001.pdf" Mit Kreditorenprefix:  "VEND001_Rechnung_2024_001.pdf" Quelldatei:  "ORIGINAL_VEND001_Rechnung_2024_001.pdf" Best Practices: Duplicate check: Always check whether prefix already exists Length validation: New file names may have a maximum of 1024 characters. Adding a field in the validation (from version 2.10) The following example extension shows how developers can add fields in the validation (here: document class invoice/credit note). Optional integration events incl. sample procedures: codeunit 50100 EventSubs {     //     // [If you want to perform plausibility checks on the newly added header field, this is the place]     //     [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoHeaderPlausibilityChecks', '', false, false)]     local procedure SQZPInvCrdtMemoImplOnBeforeDoHeaderPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.")     begin         CheckCustomer(PlausibilityCheck, DocHeader."Customer No.");     end;     //     // [If you want to perform plausibility checks on the newly added line field, this is the place]     //     [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoLinePlausibilityChecks', '', false, false)]     local procedure SQZPInvCrdtMemoImplOnAfterDoLinePlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; DocLine: Record "DXP SQZ Document Line"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.")     begin         CheckCustomer(PlausibilityCheck, DocLine."Customer No.");     end;     [TryFunction]     local procedure CustomerExists(CustomerNo: Code[20])     var         Customer: Record Customer;     begin         Customer.Get(CustomerNo);     end;     local procedure CheckCustomer(var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt."; CustomerNo: Code[20]): Boolean     begin         if CustomerNo = '' then             exit(false);         if not CustomerExists(CustomerNo) then begin             PlausibilityCheck.AddPlausibilityCheckEntry(GetLastErrorText(), Page::"Customer List");             exit(false);         end;         exit(true);     end; } Table Extensions: SQUEEZE 4 BC tableextension 50100 "SQZ Doc. Header Ext." extends "DXP SQZ Document Header" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } tableextension 50101 "SQZ Doc. Line Ext." extends "DXP SQZ Document Line" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } Target document (here: Purchase Document) tableextension 50102 "Purchase Header Ext." extends "Purchase Header" { fields { field(50100; "DXP Customer No."; Code[20]) { DataClassification = CustomerContent; TableRelation = Customer; Caption = 'DEXPRO Customer No.'; } } }   Page Extensions: SQUEEZE 4 BC pageextension 50100 "SQZ Document Ext." extends "DXP SQZ Document v2" { layout { addafter(BuyFromVendorInternal) { field("Customer No. Internal"; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; //The following code is optional. It is used to highlight a recognized value in the Squeeze Viewer trigger OnAssistEdit() begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } addafter(BuyFromVendorExternal) { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; //The following code is optional. It is used to highlight a recognized value in the Squeeze Viewer trigger OnAssistEdit() var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } } local procedure MarkField(AppFldNo: Integer; FieldVal: Variant; DocHeader: Record "DXP SQZ Document Header") var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin ViewerResident := GetViewerResident(); ApiMgt.MarkField(AppFldNo, FieldVal, ViewerResident, DocHeader); end; } pageextension 50101 "SQZ Document Sf. Ext." extends "DXP SQZ Document Subform" { layout { addafter("No.") { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; } } } } Target document (here: Purchase document) pageextension 50102 "Purchase Invoice Ext." extends "Purchase Invoice" { layout { addafter("Buy-from Vendor No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } } pageextension 50103 "Purchase Inv. Sf Ext." extends "Purch. Invoice Subform" { layout { addafter("No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } }   Implementation of a user-defined, automatic order reconciliation Introduction Automatic order matching is an important part of document processing in Squeeze for Business Central. In the standard system, the system compares incoming documents with existing orders and goods receipts. This documentation shows you how you can extend this matching process to include your own document types. The standard implementation uses a three-step process: Collect relevant document numbers based on business rules A detailed comparison is performed for each document number found. The positions read by Squeeze are then enriched with the data found. We will retain this proven approach in the following example implementation. Integration point The central integration point is the OnBeforePerformAutomaticOrdermatch event in codeunit 70954632 “DXP SQZ Document Mgt.”. This event is called after header and line data has been created. [IntegrationEvent(false, false)] local procedure OnBeforePerformAutomaticOrdermatch( DocHeader: Record "DXP SQZ Document Header"; var OrderNoList: List of [Code[20]]; var IsHandled: Boolean) Parameter DocHeader: The document header with the data to be compared OrderNoList: A list of document numbers for reconciliation IsHandled: Controls whether standard processing should be skipped Implementation example Technical implementation 1. Extension of the document type enum First, we extend the possible document types to include our own type: enumextension 50100 "Custom Order Match Doc. Type" extends "DXP Order Match Document Type" { value(50000; "Custom") { Caption = 'Custom Document'; } } 2. Implementation of the matching logic The central point of our implementation is a code unit that controls the synchronization process. The integration point is: //codeunit 50100 "Custom Document Matching" //{ [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforePerformAutomaticOrdermatch', '', false, false)] local procedure OnBeforePerformAutomaticOrdermatch( DocHeader: Record "DXP SQZ Document Header"; var OrderNoList: List of [Code[20]]; var IsHandled: Boolean) var CustomSourceDoc: Record "Custom Source Document"; CustomDocNo: Code[20]; begin // Take control of the matching process and prevent standard processing IsHandled := true; // Find potential matching documents CustomSourceDoc.SetRange("Vendor No.", DocHeader."Buy-from Vendor No."); // Add your specific document status or type filters CustomSourceDoc.SetRange("Document Type", CustomSourceDoc."Document Type"::Order); CustomSourceDoc.SetRange(Status, CustomSourceDoc.Status::Released); // Add matching document numbers to the list if CustomSourceDoc.FindSet() then repeat CustomDocNo := CustomSourceDoc."No."; if IsDocumentEligibleForMatching(CustomSourceDoc, DocHeader) then if not OrderNoList.Contains(CustomDocNo) then OrderNoList.Add(CustomDocNo); until CustomSourceDoc.Next() = 0; // Process all collected documents ProcessMatchingDocuments(DocHeader, OrderNoList); end; local procedure IsDocumentEligibleForMatching( CustomSourceDoc: Record "Custom Source Document"; DocHeader: Record "DXP SQZ Document Header"): Boolean begin // Implement business rules for document selection // For example: if CustomSourceDoc."Document Date" > DocHeader."Document Date" then exit(false); if CustomSourceDoc."Currency Code" <> DocHeader."Currency Code" then exit(false); // Check for open lines that can be matched if not HasOpenLinesToMatch(CustomSourceDoc) then exit(false); exit(true); end; local procedure HasOpenLinesToMatch(CustomSourceDoc: Record "Custom Source Document"): Boolean var CustomSourceLine: Record "Custom Source Line"; begin CustomSourceLine.SetRange("Document No.", CustomSourceDoc."No."); CustomSourceLine.SetFilter("Outstanding Quantity", '>0'); exit(not CustomSourceLine.IsEmpty()); end; //} 3. Processing of the documents found After collecting the relevant document numbers, the actual comparison takes place: local procedure ProcessMatchingDocuments( DocHeader: Record "DXP SQZ Document Header"; OrderNoList: List of [Code[20]]) var TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary; OrderNo: Code[20]; begin foreach OrderNo in OrderNoList do begin // Get matching entries for current document GetMatchEntries(OrderNo, TempMatchEntry, DocHeader); if not TempMatchEntry.IsEmpty() then // Try to find and assign matching lines TryMatchDocumentLines(TempMatchEntry, DocHeader); end; end; local procedure GetMatchEntries( DocumentNo: Code[20]; var TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary; DocHeader: Record "DXP SQZ Document Header") var CustomSourceLine: Record "Custom Source Line"; begin TempMatchEntry.Reset(); TempMatchEntry.DeleteAll(); // Get lines from custom document CustomSourceLine.SetRange("Document No.", DocumentNo); if CustomSourceLine.FindSet() then repeat // Create match entry for each relevant line CreateMatchEntry(CustomSourceLine, TempMatchEntry); until CustomSourceLine.Next() = 0; end; local procedure CreateMatchEntry( CustomSourceLine: Record "Custom Source Line"; var TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary) begin TempMatchEntry.Init(); TempMatchEntry."Document Type" := "DXP Order Match Document Type"::Custom; TempMatchEntry."Document No." := CustomSourceLine."Document No."; TempMatchEntry."Document Line No." := CustomSourceLine."Line No."; TempMatchEntry."No." := CustomSourceLine."Item No."; TempMatchEntry.Quantity := CustomSourceLine.Quantity; TempMatchEntry."Direct Unit Cost" := CustomSourceLine."Unit Price"; TempMatchEntry."Line Amount" := CustomSourceLine.Amount; TempMatchEntry.Insert(); end; The matching logic in detail The actual reconciliation of document lines is performed according to defined business rules: local procedure TryMatchDocumentLines( var TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary; DocHeader: Record "DXP SQZ Document Header") var DocLine: Record "DXP SQZ Document Line"; MatchSetup: Record "Custom Match Setup"; HasCustomSetup: Boolean; begin // Get configuration MatchSetup.Get(); // Process each potential match entry if TempMatchEntry.FindSet() then repeat DocLine.Reset(); DocLine.SetRange("Document No.", DocHeader."No."); DocLine.SetRange("Buy-from Vendor No.", TempMatchEntry."Buy-from Vendor No."); DocLine.SetFilter("Allocated Document Line No.", '%1', 0); // Only unallocated lines // Try matching strategies in order of precision if TryExactMatch(DocLine, TempMatchEntry) then CheckTolerancesAndAllocate(TempMatchEntry, DocLine, MatchSetup) else if TryItemReferenceMatch(DocLine, TempMatchEntry) then CheckTolerancesAndAllocate(TempMatchEntry, DocLine, MatchSetup) else if TryDescriptionMatch(DocLine, TempMatchEntry) then CheckTolerancesAndAllocate(TempMatchEntry, DocLine, MatchSetup) else if TryBasicValuesMatch(DocLine, TempMatchEntry) then CheckTolerancesAndAllocate(TempMatchEntry, DocLine, MatchSetup); until TempMatchEntry.Next() = 0; end; local procedure TryExactMatch( var DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary): Boolean begin DocLine.SetRange(Type, TempMatchEntry.Type); DocLine.SetFilter("No.", '%1|%2', TempMatchEntry."No.", TempMatchEntry."Item Reference No."); DocLine.SetRange("SQZ Quantity", TempMatchEntry.Quantity); exit(not DocLine.IsEmpty()); end; local procedure TryItemReferenceMatch( var DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary): Boolean begin DocLine.SetRange(Type); // Clear previous filters DocLine.SetRange("Item Reference No.", TempMatchEntry."Item Reference No."); exit(not DocLine.IsEmpty()); end; local procedure TryDescriptionMatch( var DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary): Boolean begin DocLine.SetRange("Item Reference No."); // Clear previous filter DocLine.SetFilter("SQZ Description", '@*' + TempMatchEntry.Description + '*'); exit(not DocLine.IsEmpty()); end; local procedure TryBasicValuesMatch( var DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary): Boolean begin DocLine.SetRange("SQZ Description"); // Clear previous filter DocLine.SetRange("SQZ Quantity", TempMatchEntry.Quantity); DocLine.SetRange("SQZ Unit Price", TempMatchEntry."Direct Unit Cost"); exit(not DocLine.IsEmpty()); end; local procedure CheckTolerancesAndAllocate( TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary; var DocLine: Record "DXP SQZ Document Line"; MatchSetup: Record "Custom Match Setup") begin DocLine.FindFirst(); // We know there is at least one line if IsMatchWithinTolerances(DocLine, TempMatchEntry, MatchSetup) then AssignMatchData(DocLine, TempMatchEntry); end; local procedure IsMatchWithinTolerances( DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary; MatchSetup: Record "Custom Match Setup"): Boolean var QtyTolerance: Decimal; AmountTolerance: Decimal; begin QtyTolerance := MatchSetup."Quantity Tolerance"; AmountTolerance := MatchSetup."Amount Tolerance"; if Abs(DocLine."SQZ Quantity" - TempMatchEntry.Quantity) > QtyTolerance then exit(false); if Abs(DocLine."SQZ Unit Price" - TempMatchEntry."Direct Unit Cost") > AmountTolerance then exit(false); exit(true); end; local procedure AssignMatchData( var DocLine: Record "DXP SQZ Document Line"; TempMatchEntry: Record "DXP SQZ Order Match Entry" temporary) begin // Assign the matched data to the document line DocLine.Validate("Allocated Document Type", "DXP Order Match Document Type"::Custom); DocLine.Validate("Allocated Document No.", TempMatchEntry."Document No."); DocLine.Validate("Allocated Document Line No.", TempMatchEntry."Document Line No."); DocLine.Validate("Allocated Quantity", TempMatchEntry.Quantity); DocLine.Validate("Allocated Unit Price", TempMatchEntry."Direct Unit Cost"); DocLine.Validate("Allocated Line Amount", TempMatchEntry."Line Amount"); DocLine.Validate("Allocated Line Discount %", TempMatchEntry."Line Discount %"); DocLine.Modify(true); end; Implementation of a new, generic document class SQUEEZE → Core → Your processing This guide is deliberately focused and pipeline-oriented: It shows how document data is downloaded from SQUEEZE, processed in queues, and persisted in DEXPRO Core—and where a third-party extension comes into play. Term: In this guide, “SQUEEZE app” refers to the Business Central extension that is connected to the SQUEEZE API and controls imports to DEXPRO Core. Assumptions: Third-party developers typically work with published icons, not with the entire source code. The SQUEEZE app handles downloading + import queue + creation of the core document as well as the rudimentary creation of the SQUEEZE document, taking field mapping into account, as soon as setup is complete. Your extension takes over the business logic once the core document exists: create or extend source records, validate them, generate “Processed JSON,” and optionally create your own target object or document. 1) The end-to-end process SQUEEZE → Core Once the document class and setup are configured, the SQUEEZE app's import pipeline typically runs as follows: DXP Document Class extend and bind your implementation:  DXP ISource Document. Configure settings for this Document class‑Setup. When validating DXP SQZ Document Class ID, the SQUEEZE app automatically retrieves the required setup values from SQUEEZE (e.g., DXP SQZ Export Interface ID and DXP SQZ Line Table ID) and fills them in. The SQUEEZE app job calls DXP SQZ API Mgt.DownloadDocumentData(). Can also be called via “Download documents”. New entries are created in the DXP SQZ import queue (document ID + target client). The SQUEEZE app calls DXP SQZ Import Queue Mgt.TransferImportQueueEntries(). The orchestration code unit DXP Sqz Create Document is executed for the entries in the import queue. DXP SQZ API Mgt.CreateCoreAndSQUEEZEDocument(DocClass, DocumentId) loads the complete JSON. DXP Document Mgt.AddDocument(DocClass, DocumentId, RawJson, …) is called up. Result: A DXP Document‑Record exists. Status = Imported,  JSON Raw is filled. The SQUEEZE app calls your implementation ISourceDocument.CreateSource(Document). Your implementation begins here. After step 6, you will have: A Core‑Container‑Document ( DXP Document). A SQUEEZE document in the SQUEEZE app. Your source records should exist once CreateSource has completed successfully. 2) What you implement (Interfaces) Source contract, i.e., squeeze page: DXP ISource Document You implement this to: Create your editable source data sets from DXP Document.JSON Raw Validate source data records Generate “Processed JSON” and transfer it to core processing Target contract, i.e., target document: DXP IDocument Processing You implement this if Core is to create/update its own target data set (your own table/document) from the “Processed JSON.” 3) Step 1 — Define document class and assign source implementation Create an enum extension and bind your source implementation: enumextension 50100 "MY Document Class Ext." extends "DXP Document Class" { value(50100; "MY Generic Document") { Caption = 'My Generic Document'; Implementation = "DXP ISource Document" = "MY Source Document Impl."; } } 4) Step 2 — Configure document class setup (so that the import queue is filled) Configure the SQUEEZE-specific fields in the document class setup for your new document class. Important: Validating the DXP SQZ Document Class ID triggers the automatic loading of the required configuration from SQUEEZE (e.g., DXP SQZ Export Interface ID and DXP SQZ Line Table ID). If the call fails, these API-derived fields are cleared again. Result: The SQUEEZE app can execute DownloadDocumentData() and create entries in the DXP SQZ Import Queue for your class. 5) Step 3 — Ensure field mapping (downloaded mapping + your default values) The SQUEEZE app can download the field catalog of the connected Squeeze client and persist it in Core Mapping tables (per document class). Your role as a document class implementer: Provide standard field mapping “Squeeze Field Name → AL Field No.” via InitFieldMapping(...). Alternatively, map fields via the assignment pages (custom field assignment). 5.1 Implement InitFieldMapping (independent example) codeunit 50101 "MY Source Document Impl." implements "DXP ISource Document" { procedure InitFieldMapping(var HeaderMapping: Dictionary of [Text, Integer]; var LineMapping: Dictionary of [Text, Integer]) var Header: Record "DXP SQZ Document Header"; Line: Record "DXP SQZ Document Line"; begin Clear(HeaderMapping); Clear(LineMapping); // Header fields HeaderMapping.Add('vendorNo', Header.FieldNo("Buy-from Vendor No.")); HeaderMapping.Add('documentDate', Header.FieldNo("Document Date")); HeaderMapping.Add('postingDate', Header.FieldNo("Posting Date")); HeaderMapping.Add('reference', Header.FieldNo("Document Reference")); // Line fields LineMapping.Add('description', Line.FieldNo(Description)); LineMapping.Add('quantity', Line.FieldNo(Quantity)); LineMapping.Add('unitPrice', Line.FieldNo("Direct Unit Cost")); end; // other interface methods omitted here... } 5.2 Validation switch when assigning fields: Validate app field When the SQUEEZE app or your source creation logic writes JSON values to “app/source fields,” you can control whether the OnValidate trigger is executed. In  DXP Custom Field Mapping: Validate App Field = Validate the app field during the assignment. Validate (Target) = Perform validation when transferring to the target field. Use this, for example, if extension fields have business logic in OnValidate or if you want to assign deliberately trigger-free (higher performance). 6) Step 4 — Create Source data sets in CreateSource CreateSource(Document) is called by the SQUEEZE app immediately after DXP Document Mgt.AddDocument(...) as soon as the core container data record exists. Minimum responsibilities: Read DXP Document.JSON Raw. Create SQUEEZE‑Source‑Header/Lines ( DXP SQZ Document Header /  DXP SQZ Document Line). Connect Core‑document with SQUEEZE‑Source‑Header via UpdateDocumentAfterTransfer. Optional (recommended if you want functionality equivalent to the standard SQUEEZE document classes): 4) Download attachments if DXP Download Attachments is active. 5) Perform automatic validation if enabled for the document. 6.1 Example: Create SQUEEZE‑Header + Lines with generic helpers What the helpers do (so you don't have to implement it twice): SqzDocumentMgt.CreateSQUEEZEDocHeader(Document, DocHeader, RawJson) Creates exactly one data record in DXP SQZ Document Header for the Core‑document ( DXP Document). Sets identification fields as Core Document No. and the SQUEEZE‑ API Document ID. Assigns header fields from JSON based on the configured mappings: DXP Field Mapping (field mapping) DXP Custom Field Mapping (Custom field mapping) Respects DXP Custom Field Mapping.Validate App Field and thus decides whether the OnValidate trigger is executed when assigning. Executes the integration event OnBeforeModifySQUEEZEDocumentHeader(...) as an extension hook. Standard post-processing is also performed for the built-in standard SQUEEZE classes (e.g., alternative IBAN/VAT ID determination, supplier update, standard posting date, duplicate check). SqzDocumentMgt.CreateSQUEEZEDocLine(DocHeader, RawJson) Creates the DXP SQZ Document Line‑data sets based on the JSON‑Rows. Assign line fields using the same mapping principle (standard + custom; optionally with validation triggers). Fill the Core Document No. in the lines. For standard SQUEEZE classes, standard line post-processing is also applied (e.g., transfer of recognized values). Persists line-related auxiliary data (e.g., coordinates/metadata that use the UI and matching logic). procedure CreateSource(Document: Record "DXP Document"): Boolean var DocClassSetup: Record "DXP Document Class Setup"; AutoValidationMgt: Codeunit "DXP Automatic Validation Mgt."; JsonHelper: Codeunit "DXP Json Helper"; DocMgt: Codeunit "DXP Document Mgt."; SqzDocumentMgt: Codeunit "DXP SQZ Document Mgt."; SqzApiMgt: Codeunit "DXP SQZ API Mgt."; RawJson: JsonObject; DocHeader: Record "DXP SQZ Document Header"; AutomaticValidation: Boolean; begin if (not Document."JSON Raw".HasValue()) or (Document.Status <> Document.Status::Imported) then exit(false); // 1) Unverarbeitetes JSON lesen RawJson := JsonHelper.JObjectFromBlob(Document.RecordId(), Document.FieldNo("JSON Raw")); // 2) SQUEEZE‑Source‑Dokument mit den generischen Hilfsfunktionen erstellen // (Feldzuordnung + optionales Validierungs‑Trigger‑Verhalten wird im Helper behandelt) SqzDocumentMgt.CreateSQUEEZEDocHeader(Document, DocHeader, RawJson); SqzDocumentMgt.CreateSQUEEZEDocLine(DocHeader, RawJson); // 3) Core → SQUEEZE‑Source‑Header verknüpfen DocMgt.UpdateDocumentAfterTransfer(Document."No.", Document.Status::Transferred, DocHeader."API Document ID", DocHeader.RecordId()); // 4) Optional: Anhänge herunterladen und speichern // (gesteuert über die Dokumentenklassen‑Einrichtung) if DocClassSetup.Get(DocHeader."Document Class") then if DocClassSetup."DXP Download Attachments" then SqzApiMgt.DownloadAndSaveAttachments(DocHeader); // 5) Optional: Automatische Validierung // Wenn aktiviert, führt die Validierung die Plausibilitätsprüfungen aus und erstellt das „Processed JSON“. AutomaticValidation := AutoValidationMgt.AutomaticValidationActivated(DocHeader."No."); if AutomaticValidation then SqzDocumentMgt.ValidateSQUEEZEDocument(DocHeader, AutomaticValidation); exit(true); end; 7) Step 5 — Validation + Handover „Processed JSON“ 7.1 Validation: IsSourceDataPlausible Use the Core Plausibility Framework to ensure that errors are displayed consistently: procedure IsSourceDataPlausible(Source: Variant; var TempPlausibilityCheckEntry: Record "DXP Plausibility Check Entry" temporary): Boolean var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt."; Header: Record "DXP SQZ Document Header"; begin if not Source.IsRecord then exit(false); Header := Source; TempPlausibilityCheckEntry.DeleteAll(); PlausibilityCheck.FieldIsEmpty(Header, Header.FieldNo("Buy-from Vendor No."), 0, false, false); PlausibilityCheck.CheckPostingDate(Header."Posting Date", Header.FieldNo("Posting Date")); PlausibilityCheck.GetPlausibilityCheckEntries(TempPlausibilityCheckEntry); exit(TempPlausibilityCheckEntry.IsEmpty()); end; 7.2 Build „Processed JSON“ and pass it to the core: CreateProcessedJsonFromSource Core stores “Processed JSON” in DXP Document.JSON Processed and transfers it to your target processing. procedure CreateProcessedJsonFromSource(Source: Variant) var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; DocMgt: Codeunit "DXP Document Mgt."; JsonHelper: Codeunit "DXP Json Helper"; DocTransferMgt: Codeunit "DXP Document Transfer Mgt."; Header: Record "DXP SQZ Document Header"; Line: Record "DXP SQZ Document Line"; HeaderJObj: JsonObject; LinesJArr: JsonArray; LineJObj: JsonObject; begin Header := Source; HeaderJObj.Add(CoreTokenMgt.GetVendorNoTok(), Header."Buy-from Vendor No."); HeaderJObj.Add(CoreTokenMgt.GetDocDateTok(), Header."Document Date"); HeaderJObj.Add(CoreTokenMgt.GetDocReferenceTok(), Header."Document Reference"); // Benutzerdefinierte Felder (Erweiterungsfelder) aus den Source‑Tabellen hinzufügen HeaderJObj.Add(CoreTokenMgt.GetCustomFieldsTok(), JsonHelper.Rec2JsonFieldArray(Header, true, true, Header."Document Class", Enum::"DXP Field Type"::Header)); Line.SetRange("Document No.", Header."No."); if Line.FindSet() then repeat Clear(LineJObj); LineJObj.Add(CoreTokenMgt.GetDescriptionTok(), Line.Description); LineJObj.Add(CoreTokenMgt.GetQtyTok(), Line.Quantity); LineJObj.Add(CoreTokenMgt.GetCustomFieldsTok(), JsonHelper.Rec2JsonFieldArray(Line, true, true, Header."Document Class", Enum::"DXP Field Type"::Line)); LinesJArr.Add(LineJObj); until Line.Next() = 0; DocTransferMgt.AddDocLinesToHeaderJson(HeaderJObj, LinesJArr); // An Core‑Zielverarbeitung übergeben DocMgt.UpdateDocument( Header."Core Document No.", Enum::"DXP Document Status"::Transferred, Enum::"DXP Target Document Process"::"MY Create Custom Document", Enum::"DXP Next process step"::"Standard document", HeaderJObj); end; 8) Step 6 — Create your own target document If you want Core to create your own target data set, extend DXP Target Document Process and implement DXP IDocument Processing: enumextension 50102 "MY Target Doc Process Ext." extends "DXP Target Document Process" { value(50102; "MY Create Custom Document") { Caption = 'Create My Custom Document'; Implementation = "DXP IDocument Processing" = "MY Custom Doc Creation"; } } codeunit 50103 "MY Custom Doc Creation" implements "DXP IDocument Processing" { procedure ProcessStandardDocument(JObject: JsonObject): RecordId var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; DocTransferMgt: Codeunit "DXP Document Transfer Mgt."; JsonHelper: Codeunit "DXP Json Helper"; MyDoc: Record "MY Custom Document"; TargetVariant: Variant; begin MyDoc.Init(); MyDoc.Validate("Vendor No.", JsonHelper.ValAsTxt(JObject, CoreTokenMgt.GetVendorNoTok(), false)); MyDoc.Validate("Document Date", JsonHelper.ValAsDate(JObject, CoreTokenMgt.GetDocDateTok(), false)); MyDoc.Insert(true); // Überträgt Metadaten sowie benutzerdefinierte/zusätzliche Felder anhand der Core‑Zuordnungen in den Ziel‑Datensatz. TargetVariant := MyDoc; DocTransferMgt.ProcessAdditionalInformation(JObject, TargetVariant); MyDoc := TargetVariant; exit(MyDoc.RecordId()); end; } Note: The transfer of metadata and user-defined/additional fields is already included in the above example and is based on the core mapping tables. 9) Troubleshooting (quick checks) No entries in DXP SQZ Import Queue → Document class setup for SQUEEZE is incomplete. Core‑ DXP Document exists, but no source record → Your CreateSource(Document) has failed or returns false. Source exists, but target is not created → CreateProcessedJsonFromSource is not called or DXP Target Document Process is not configured. Incorrect trigger behavior when assigning → Check DXP Custom Field Mapping.Validate App Field and  Validate. Validate controls whether validation of the target field (OnValidate) is performed. 10) What Core does automatically When you call up DXP Document Mgt.UpdateDocument(...): Core stores the “Processed JSON” in DXP Document. JSON Processed. Core sets DXP Document. Status to the transferred status. Core linked/updated DXP Document. Linked-to Record Id with the record, which your DXP IDocument Processing‑implementation returns. Core transfers Core attachments to the returned data set (and typically appends the “Processed JSON” as a .json attachment). Custom Document Creation (Custom Processing)   Table of Contents Overview Understanding the Document Flow JSON Data Structure Quick Start: Simple Custom Processing Overview This guide explains how to create custom Business Central documents from JSON data provided by DEXPRO Core. The system receives documents with status "Custom Processing", which third-party developers can transform into any BC document type (Purchase Orders, Sales Orders, G/L Journals, Service Orders, etc.). What You'll Learn How to intercept documents marked for custom processing The JSON structure containing document header, lines, metadata, and custom fields How to create your custom document Understanding the Document Flow Core Workflow ┌─────────────────────────────────────────────────────────────────┐ │ 1. Document Import │ │ JSON Raw Data → DXP Document (Status: Imported) │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 2. Source Document Creation │ │ ISourceDocument.CreateSource() → Your Source Tables │ │ (e.g., SQZ Document Header/Lines or Your Custom Tables) │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 3. Validation & Plausibility Checks │ │ ISourceDocument.IsSourceDataPlausible() │ │ → Validates data quality, checks for errors │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 4. Create Processed JSON │ │ ISourceDocument.CreateProcessedJsonFromSource() │ │ → Builds JSON structure for target document │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 5. Update Core Document with "Custom Processing" Status │ │ UpdateDocument() → Sets Status to "Custom Processing" │ │ → Stores JSON Processed in DXP Document │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 6. Your Custom Processing (THIS IS WHERE YOU HOOK IN!) │ │ Subscribe to events or implement interface │ │ → Read JSON Processed from DXP Document │ │ → Create your target BC document │ └────────────────────────┬────────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────────┐ │ 7. Final Status Update │ │ Document Status → Transferred or Finished │ │ Linked-to Record Id → Your created BC document │ └─────────────────────────────────────────────────────────────────┘ Key Status Values Status Description Imported Raw JSON received, not yet processed Transferred Source document created, ready for processing Custom Processing Your target status - Document ready for custom handling Finished Target document successfully created Deleted Processing complete, document archived JSON Data Structure Overview The "JSON Processed" blob in the DXP Document table contains a structured JSON object with all information needed to create your target document. Complete JSON Structure { // ═══════════════════════════════════════════════════════════ // HEADER SECTION - Document-level information // ═══════════════════════════════════════════════════════════ "Type": "Invoice", // Document type: Invoice, Credit Memo, Order, etc. "VendorNo": "VENDOR001", // Vendor/Customer number "DocumentDate": "2025-10-15", // Document date "PostingDate": "2025-10-16", // Posting date "DocumentReference": "INV-2025-001", // External document number "OrderNo": "PO-12345", // Reference to order (if applicable) "PostingDescription": "Invoice Q4", // Posting description "NetAmount": 1000.00, // Net amount (excluding tax) "TotalAmount": 1190.00, // Gross amount (including tax) "TaxAmount": 190.00, // Total tax amount "Currency": "EUR", // Currency code "ResponsibilityCenter": "BERLIN", // Responsibility center (blank: default from user setup / vendor) "VATBusPostingGroup": "EU", // VAT business posting group (blank: vendor default) - the lines' default // ─────────────────────────────────────────────────────────── // DIMENSIONS - Header-level dimensions as key-value pairs // ─────────────────────────────────────────────────────────── "Dimensions": { "DEPARTMENT": "SALES", "PROJECT": "PROJ001", "COSTCENTER": "CC-100" }, // ─────────────────────────────────────────────────────────── // CUSTOM FIELDS - Additional header fields (see below) // ─────────────────────────────────────────────────────────── "CustomFields": [ { "Id": 50100, "Name": "CustomerNo", "Value": "CUST001", "Caption": "Customer Number" }, { "Id": 50101, "Name": "DeliveryTerms", "Value": "EXW", "Caption": "Delivery Terms" } ], // ─────────────────────────────────────────────────────────── // METADATA - System-generated field mappings // ─────────────────────────────────────────────────────────── "Metadata": [ { "DocumentClass": "DXP Invoice / Credit Memo", "FieldType": "Header", "FieldId": 101, "Value": "Additional Info" } ], // ═══════════════════════════════════════════════════════════ // LINES SECTION - Document line items // ═══════════════════════════════════════════════════════════ "Lines": [ { // ───────────────────────────────────────────────────────── // Line Basic Information // ───────────────────────────────────────────────────────── "Type": "Item", // Item, G/L Account, Charge (Item), Fixed Asset "No": "ITEM001", // Item/Account number "Description": "Product A", // Line description "VendorItemNo": "VEND-SKU-123", // Vendor's item number "Quantity": 10.0, // Quantity "UnitOfMeasure": "PCS", // Unit of measure "DirectUnitCost": 100.00, // Unit price "LineDiscount": 5.0, // Line discount percentage // ───────────────────────────────────────────────────────── // Line Amounts & Tax // ───────────────────────────────────────────────────────── "NetAmount": 950.00, // Line net amount "TotalAmount": 1130.50, // Line gross amount "TaxRate": 19.0, // Tax percentage "VATBusPostingGroup": "DOMESTIC", "VATProdPostingGroup": "STANDARD", "GenBusPostingGroup": "DOMESTIC", "GenProdPostingGroup": "RETAIL", // ───────────────────────────────────────────────────────── // Order Reference (for matching) // ───────────────────────────────────────────────────────── "OrderNo": "PO-12345", // Referenced order number "OrderLineNo": 10000, // Referenced order line number "ReceiptNo": "RCP-001", // Referenced receipt number "ReceiptLineNo": 10000, // Referenced receipt line number // ───────────────────────────────────────────────────────── // Line Dimensions // ───────────────────────────────────────────────────────── "Dimensions": { "DEPARTMENT": "PROD", "PROJECT": "PROJ001" }, // ───────────────────────────────────────────────────────── // Line Custom Fields // ───────────────────────────────────────────────────────── "CustomFields": [ { "Id": 50200, "Name": "SerialNo", "Value": "SN-12345", "Caption": "Serial Number" } ], // ───────────────────────────────────────────────────────── // Line Metadata // ───────────────────────────────────────────────────────── "Metadata": [ { "DocumentClass": "DXP Invoice / Credit Memo", "FieldType": "Line", "FieldId": 201, "Value": "Line-specific metadata" } ] } // ... additional lines ] } Custom Fields vs. Metadata Custom Fields: User-defined fields from your app Mapped via Custom Field Mapping Can be mapped to any field in the Squeeze Validation Example: Adding a "Customer No." to the Squeeze Validation Metadata: System-generated fields Extracted by the Squeeze System but not mapped to any Field in BC Quick Start: Simple Custom Processing Scenario You want to create a custom document type (e.g., a Warehouse Shipment) from documents marked with "Custom Processing" status. Step 1: Subscribe to the Integration Event Create a codeunit to intercept documents with "Custom Processing" status: codeunit 50100 "My Custom Document Handler" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Mgt.", 'OnAfterWriteProcessedJsonToBlob', '', true, true)] local procedure OnAfterWriteProcessedJsonToBlob( var Document: Record "DXP Document"; var ProcessedJSONObj: JsonObject) begin // Only handle Custom Processing status if Document.Status <> Document.Status::"Custom Processing" then exit; // Create your custom document CreateMyCustomDocument(Document, ProcessedJSONObj); end; local procedure CreateMyCustomDocument( var Document: Record "DXP Document"; ProcessedJSON: JsonObject) var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; JsonHelper: Codeunit "DXP Json Helper"; MyCustomHeader: Record "My Custom Document Header"; MyCustomLine: Record "My Custom Document Line"; LineJArray: JsonArray; LineJToken: JsonToken; LineJObj: JsonObject; begin // ═══════════════════════════════════════════════════════ // 1. CREATE HEADER // ═══════════════════════════════════════════════════════ MyCustomHeader.Init(); MyCustomHeader."No." := ''; // Will be assigned by number series // Read standard header fields MyCustomHeader."Vendor No." := JsonHelper.ValAsTxt(ProcessedJSON, CoreTokenMgt.GetVendorNoTok(), false); MyCustomHeader."Document Date" := JsonHelper.ValAsDate(ProcessedJSON, CoreTokenMgt.GetDocDateTok(), false); MyCustomHeader."Document Reference" := JsonHelper.ValAsTxt(ProcessedJSON, CoreTokenMgt.GetDocReferenceTok(), false); MyCustomHeader.Insert(true); // ═══════════════════════════════════════════════════════ // 2. PROCESS DIMENSIONS (if your document supports them) // ═══════════════════════════════════════════════════════ ProcessHeaderDimensions(ProcessedJSON, MyCustomHeader); // ═══════════════════════════════════════════════════════ // 3. PROCESS CUSTOM FIELDS // ═══════════════════════════════════════════════════════ ProcessCustomFields(ProcessedJSON, MyCustomHeader); // ═══════════════════════════════════════════════════════ // 4. CREATE LINES // ═══════════════════════════════════════════════════════ LineJArray := JsonHelper.ReadJArrayFromObj(ProcessedJSON, CoreTokenMgt.GetLinesTok()); foreach LineJToken in LineJArray do begin LineJObj := LineJToken.AsObject(); MyCustomLine.Init(); MyCustomLine."Document No." := MyCustomHeader."No."; MyCustomLine."Line No." := GetNextLineNo(MyCustomHeader."No."); // Read line fields MyCustomLine."Item No." := JsonHelper.ValAsTxt(LineJObj, CoreTokenMgt.GetNoTok(), false); MyCustomLine.Description := JsonHelper.ValAsTxt(LineJObj, CoreTokenMgt.GetDescriptionTok(), false); MyCustomLine.Quantity := JsonHelper.ValAsDec(LineJObj, CoreTokenMgt.GetQtyTok(), false); MyCustomLine."Unit of Measure" := JsonHelper.ValAsTxt(LineJObj, CoreTokenMgt.GetUoMTok(), false); MyCustomLine.Insert(true); // Process line dimensions and custom fields if needed ProcessLineDimensions(LineJObj, MyCustomLine); ProcessLineCustomFields(LineJObj, MyCustomLine); end; // ═══════════════════════════════════════════════════════ // 5. UPDATE CORE DOCUMENT STATUS // ═══════════════════════════════════════════════════════ UpdateCoreDocument(Document, MyCustomHeader); end; local procedure ProcessHeaderDimensions(ProcessedJSON: JsonObject; var MyCustomHeader: Record "My Custom Document Header") var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; DocTransferMgt: Codeunit "DXP Document Transfer Mgt."; DimensionsJObj: JsonObject; DimSetID: Integer; begin // Read dimensions from JSON if ProcessedJSON.Contains(CoreTokenMgt.GetDimensionsTok()) then begin ProcessedJSON.Get(CoreTokenMgt.GetDimensionsTok(), DimensionsJObj); // Convert to Dimension Set ID if DocTransferMgt.GetDimSetIdFromJsonObj(DimensionsJObj, DimSetID) then begin MyCustomHeader."Dimension Set ID" := DimSetID; MyCustomHeader.Modify(true); end; end; end; local procedure ProcessCustomFields(ProcessedJSON: JsonObject; var MyCustomHeader: Record "My Custom Document Header") var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; JsonHelper: Codeunit "DXP Json Helper"; CustomFieldsJArray: JsonArray; CustomFieldJToken: JsonToken; CustomFieldJObj: JsonObject; FieldName: Text; FieldValue: Text; begin // Read custom fields array if not ProcessedJSON.Contains(CoreTokenMgt.GetCustomFieldsTok()) then exit; CustomFieldsJArray := JsonHelper.ReadJArrayFromObj(ProcessedJSON, CoreTokenMgt.GetCustomFieldsTok()); foreach CustomFieldJToken in CustomFieldsJArray do begin CustomFieldJObj := CustomFieldJToken.AsObject(); FieldName := JsonHelper.ValAsTxt(CustomFieldJObj, CoreTokenMgt.GetNameTok(), false); FieldValue := JsonHelper.ValAsTxt(CustomFieldJObj, CoreTokenMgt.GetValueTok(), false); // Map to your custom fields case FieldName of 'CustomerNo': MyCustomHeader."Customer No." := CopyStr(FieldValue, 1, 20); 'DeliveryTerms': MyCustomHeader."Delivery Terms" := CopyStr(FieldValue, 1, 10); // Add more field mappings as needed end; end; MyCustomHeader.Modify(true); end; local procedure ProcessLineDimensions(LineJObj: JsonObject; var MyCustomLine: Record "My Custom Document Line") var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; DocTransferMgt: Codeunit "DXP Document Transfer Mgt."; DimensionsJObj: JsonObject; DimSetID: Integer; begin if LineJObj.Contains(CoreTokenMgt.GetDimensionsTok()) then begin LineJObj.Get(CoreTokenMgt.GetDimensionsTok(), DimensionsJObj); if DocTransferMgt.GetDimSetIdFromJsonObj(DimensionsJObj, DimSetID) then begin MyCustomLine."Dimension Set ID" := DimSetID; MyCustomLine.Modify(true); end; end; end; local procedure ProcessLineCustomFields(LineJObj: JsonObject; var MyCustomLine: Record "My Custom Document Line") var CoreTokenMgt: Codeunit "DXP Core Token Mgt."; JsonHelper: Codeunit "DXP Json Helper"; CustomFieldsJArray: JsonArray; CustomFieldJToken: JsonToken; CustomFieldJObj: JsonObject; FieldName: Text; FieldValue: Text; begin if not LineJObj.Contains(CoreTokenMgt.GetCustomFieldsTok()) then exit; CustomFieldsJArray := JsonHelper.ReadJArrayFromObj(LineJObj, CoreTokenMgt.GetCustomFieldsTok()); foreach CustomFieldJToken in CustomFieldsJArray do begin CustomFieldJObj := CustomFieldJToken.AsObject(); FieldName := JsonHelper.ValAsTxt(CustomFieldJObj, CoreTokenMgt.GetNameTok(), false); FieldValue := JsonHelper.ValAsTxt(CustomFieldJObj, CoreTokenMgt.GetValueTok(), false); // Map to your line custom fields case FieldName of 'SerialNo': MyCustomLine."Serial No." := CopyStr(FieldValue, 1, 50); // Add more field mappings end; end; MyCustomLine.Modify(true); end; local procedure UpdateCoreDocument(var Document: Record "DXP Document"; MyCustomHeader: Record "My Custom Document Header") var DocumentMgt: Codeunit "DXP Document Mgt."; begin // Update the core document to link it to your created document Document.Status := Document.Status::Transferred; Document."Linked-to Record Id" := MyCustomHeader.RecordId; Document.Modify(true); // Optionally, transfer attachments from Core to your document TransferAttachments(Document, MyCustomHeader); end; local procedure TransferAttachments(Document: Record "DXP Document"; MyCustomHeader: Record "My Custom Document Header") var DocAttachment: Record "DXP Document Attachment"; MyDocAttachment: Record "Document Attachment"; InStr: InStream; begin DocAttachment.SetRange("Document No.", Document."No."); if DocAttachment.FindSet() then repeat MyDocAttachment.Init(); MyDocAttachment.ID := 0; DocAttachment."File Content".CreateInStream(InStr); MyDocAttachment.SaveAttachmentFromStream( InStr, MyCustomHeader.RecordId, DocAttachment."File Name"); until DocAttachment.Next() = 0; end; local procedure GetNextLineNo(DocumentNo: Code[20]): Integer var MyCustomLine: Record "My Custom Document Line"; begin MyCustomLine.SetRange("Document No.", DocumentNo); if MyCustomLine.FindLast() then exit(MyCustomLine."Line No." + 10000); exit(10000); end; } Key Helper Codeunits Codeunit Purpose DXP Core Token Mgt. Provides token names for JSON fields (GetVendorNoTok(), GetDocDateTok(), etc.) DXP Json Helper JSON parsing utilities (ValAsTxt(), ValAsDate(), ReadJArrayFromObj(), etc.) DXP Document Transfer Mgt. Dimension processing, metadata transfer, custom field handling DXP Document Mgt. Core document management (UpdateDocument(), UpdateDocumentStatus(), etc.) For questions or clarifications, please contact DEXPRO Solutions GmbH. Rule-based next process step: routing documents to Custom Processing Audience This guide is intended for developers and implementers who use DEXPRO SQUEEZE in Business Central and want to control, before the actual "Custom Processing" implementation, which documents should switch to the "Custom Processing" status after validation. Context (comes before the existing Custom Processing guide) With this configuration you ensure that a document (depending on rules) is given the "Custom Processing" status. From that point on, the flow for custom processing described in the existing documentation takes over (creating target documents from "JSON Processed"). Further reading (next step, after this documentation): Creating custom documents (Custom Processing) UI terms used The following terms correspond to the field captions used in the app: "Custom Processing" = DXP Document Status / Custom Processing "Next Process Step" = Next Process Step "Standard document" = enum value Standard document "Rule Set", "Rule Set Code" = Rule Set, Rule Set Code "Rule Group", "Rule Group Code" = Rule Group, Rule Group Code Technical background There is one document class setup ( DXP Document Class Setup) per document class. A SQUEEZE rule set is created automatically for each document class setup (internally: field "DXP Sqz Rule Set Code"). A rule group code is stored in the document class setup (internally: field "DXP Sqz Next Step Rule Group"). When the next process step is determined, the rules of this rule group are evaluated. If a rule matches and Next Process Step = "Standard document" and Custom Processing = Yes, then the document status is set to "Custom Processing". Important: If no rule group is stored or no rule matches, the system falls back to the default "Next Process Step" value from the document class setup. Prerequisites DEXPRO Core and DEXPRO SQUEEZE are installed. You have access to the Document Class Setup (DXP Document Class Setup) page as well as the rule engine pages (rule groups / rules). Step by step: creating and linking the "DXP Sqz Next Step Rule Group" rule group 1) Open the document class setup Open the Document Class Setup page. Select the document class for which you want to enable routing to "Custom Processing". Scroll to the Squeeze area → Rules group. {add screenshot of Document Class Setup - Squeeze Rules here} 2) Create the rule group In Squeeze → Rules, select the "Next Process Step" field (technically: DXP Sqz Next Step Rule Group). Open the lookup (rule group list). Create a new rule group: Rule Group Code: for example Next Step Rules Description: for example "Routing to Custom Processing" Note: The lookup is already filtered to the matching rule set code by the document class. You do not need to search for the rule set manually. {add screenshot of rule group lookup here} 3) Save the rule group in the document class setup Make sure that the "Next Process Step" field in the document class setup now contains the rule group code DXP Sqz Next Step Rule Group. {add screenshot of document class setup with rule group code here} Step by step: creating a rule that routes to "Custom Processing" 4) Open the rules of the rule group Open the rule group DXP Sqz Next Step Rule Group you just created. Choose the "Show Rules" action (opens the rules of this rule group). {add screenshot of Show Rules action here} 5) Create a new rule Create a new rule. Set a meaningful priority (lower value = higher priority, if your environment is configured that way). Define the conditions (rule conditions) that must match. [Best Practice] Start with a very clear, testable condition (for example based on document type, vendor, amount thresholds, company, etc.) before you build complex rule chains. {add screenshot of new rule here} 6) Set the SQUEEZE-specific fields (decisive for "Custom Processing") On the rule card there is a "DEXPRO Squeeze" area (CardPart). Set the following there: Next Process Step = "Standard document" Custom Processing = Yes Result: When this rule matches, the document status is set to "Custom Processing". {add screenshot of rule card DEXPRO Squeeze area here} Optional: Account Assignment Code (if you additionally want to control account assignment logic via rules; independent of the Custom Processing routing). Checks / troubleshooting The document does not end up in "Custom Processing" Work through these points: Is the rule group stored? The rule group code must be set in the document class setup (otherwise the system falls back to the default "Next Process Step"). Does a rule match? If no rule matches, the next process step is not overwritten. Is "Custom Processing" set AND Next Step = "Standard document"? If "Custom Processing" = Yes but Next Step ≠ "Standard document", the status is not set to "Custom Processing". Can you not see the "DEXPRO Squeeze" area on the rule card? Then you are most likely in a rule set that does not belong to the document class setup (source table). It is best to create the rule group via the lookup from the document class setup. This saves you the detour via the general rule management. The document ends up in "Done" instead of "Custom Processing" If a rule matches and Next Process Step is set to a value other than "Standard document", the status may be set to "Done" (which skips further processing). Therefore check the Next Step selection in the rule. This is the case, for example, when the Breeze Interface app is used. Afterwards (transition into the existing documentation on custom document creation) As soon as a document is in the "Custom Processing" status, it is ready for processing: Read "JSON Processed" from DXP Document Create target documents Set the final status Embedding the SQUEEZE Viewer part in your own pages WIP Diese Anleitung beschreibt, wie Sie den SQUEEZE Viewer in beliebige Seiten einbetten (eigene Pages oder Page Extensions) – über den wiederverwendbaren Viewer‑Part: Page: "DXP SQZ Viewer Part" (PageType =  CardPart) Source table: "DXP SQZ Document Header" Der Viewer‑Part hostet die SQUEEZE Control Add-ins und lädt die Preview‑URL anhand des aktuellen Datensatzes DXP SQZ Document Header. Referenz‑Implementierung, die in dieser App bereits enthalten ist: Page "DXP SQZ Document (Generic)" (Card, SourceTable DXP SQZ Document Header) bettet den Viewer‑Part als FactBox ein und verdrahtet das Resident‑Sharing zur generischen Lines‑Subform. Page "DXP SQZ Doc. Generic Subform" (ListPart, SourceTable DXP SQZ Document Line) enthält eine bekannte, funktionierende Minimal‑Implementierung von  MarkRow(). Die Pages können Sie benutzen und mit ihren Feldern erweitern. Die Page "DXP SQZ Document (Generic)" verfügt über einen Viewer in der Factbox und die wichtigsten Actions. 1) Voraussetzungen Ihre Extension muss von der DEXPRO SQUEEZE App abhängig sein (damit Page/Control Add-ins als Symbole verfügbar sind). Der Host‑Datensatz muss eine Möglichkeit bieten, einen DXP SQZ Document Header Datensatz zu referenzieren. Die  SourceTable des Viewer‑Parts ist fest auf DXP SQZ Document Header. Deshalb muss Ihre Seite ein Feld haben (oder bereitstellen), das sich in  SubPageLink verwenden lässt, um den Header zu finden. Alternativ kann der Record in dem Viewer-Part gesetzt werden - Beispiele folgen weiter unten. SQUEEZE muss aktiviert und konfiguriert sein (Setup + API Key). Der Viewer‑Part lädt absichtlich nicht, wenn das Modul nicht aktiviert ist. 2) Empfohlenes Einbettungsmuster 2.1 Als FactBox einbetten (empfohlen) Für die meisten Szenarien (Card Pages, List Pages) platzieren Sie den Viewer in  area(FactBoxes). Wenn die  SourceTable Ihrer Seite DXP SQZ Document Header ist layout { area(FactBoxes) { part(SQZViewer; "DXP SQZ Viewer Part") { ApplicationArea = All; Caption = 'Viewer'; // Link the FactBox part to the current SQZ header SubPageLink = "No." = field("No."); } } } Wenn die  SourceTable Ihrer Seite NICHT DXP SQZ Document Header ist Sie können den Viewer‑Part trotzdem einbetten, sofern Ihr Datensatz ein Feld enthält, das die SQUEEZE Header‑Nummer speichert. Beispiel: Ihr Datensatz hat ein Feld  "SQZ Document No." : Code[20] layout { area(FactBoxes) { part(SQZViewer; "DXP SQZ Viewer Part") { ApplicationArea = All; Caption = 'Viewer'; // Link the viewer part’s "No." to your field SubPageLink = "No." = field("SQZ Document No."); } } } Wichtig: Setze am Part nicht  Enabled = false. Wenn eine FactBox‑Part deaktiviert ist, kann das verhindern, dass das Control Add-in „ready“ wird – dadurch bleibt der Viewer ggf. dauerhaft leer. 2.2 Viewer dynamisch binden (ohne  SubPageLink) Wenn Ihre Host‑Seite keinen einfachen  SubPageLink anbieten kann (z. B. weil es sich um eine Zielbeleg‑Seite wie Purchase Invoice handelt und dort die SQUEEZE Belegnummer nicht gespeichert ist), können Sie den Viewer‑Part trotzdem einbetten und im Code binden. Konzept: Viewer‑Part als FactBox hinzufügen – ohne  SubPageLink. In  OnAfterGetCurrRecord() den relevanten  Record "DXP SQZ Document Header" auflösen. Den Datensatz per  CurrPage..Page.SetSqzRecord(SqzHeader); in den Part pushen. Warum  SetSqzRecord? Im DEXPRO SQUEEZE Viewer‑Part läuft das Laden der URL in  OnAfterGetCurrRecord(). Beim Navigieren innerhalb einer Seite (z. B. Wechsel zwischen Purchase Invoices) kann  SetRecord(...) allein dazu führen, dass die FactBox nicht sofort neu lädt. SetSqzRecord(...) ist dafür gedacht, den Header sauber neu zu binden und einen Refresh auszulösen, sodass die korrekte Preview ohne Schließen/Öffnen der Seite geladen wird. Beispiel‑Gerüst: layout { area(FactBoxes) { part(SQZViewer; "DXP SQZ Viewer Part") { ApplicationArea = All; Caption = 'Viewer'; } } } trigger OnAfterGetCurrRecord() var SqzHeader: Record "DXP SQZ Document Header"; begin if TryResolveSqzHeaderForCurrentRecord(SqzHeader) then CurrPage.SQZViewer.Page.SetSqzRecord(SqzHeader); end; Dieses Pattern ist besonders für Third‑party Pages hilfreich, weil es vermeidet, „SQUEEZE Document No.“ als Tabellenfeld persistieren zu müssen. 3) Viewer‑Modus (Belegübersicht / Positionsfokus / Abgedockt) Wenn der Viewer als FactBox eingebettet ist, sind Felder typischerweise nicht editierbar. Deshalb bietet der Viewer‑Part Actions, um den Viewer‑Modus zu ändern. Was beim Wechsel des Modus passiert: Belegübersicht: Zeigt eine Übersichtliche Darstellung des Viewers an. Positionsfokus: Zeigt eine schmalere Darstellung des Viewers an. Abgedockt: Öffnet den Viewer in einem externen Fenster Für Third‑party Entwickler: Sie müssen keine eigene Mode‑Logik implementieren. Nutzen Sie die Actions des Viewer‑Parts (erscheinen im FactBox Action‑Menü). 4) Optional, aber wichtig: Zeilen‑Highlighting aktivieren (MarkRow) Wenn Sie eine Lines‑Subform haben und die Benutzererfahrung „Zeile klicken → Viewer markiert Koordinaten“ wünschen, muss Ihre Lines‑Page Messages über dieselbe Viewer‑Resident‑Instanz posten, die der Viewer‑Part initialisiert. Warum das wichtig ist: Die Viewer‑UI ist eine Control Add‑in Instanz, die in einer Codeunit DXP SQUEEZE Viewer Resident gespeichert wird. Wenn Ihre Lines‑Page eine eigene Variable  DXP SQUEEZE Viewer Resident verwendet (die nicht vom Viewer‑Part initialisiert wurde), hat  ApiMgt.PostMessage(...) keine Control‑Add‑in Instanz zum Ansprechen – es wird nichts markiert. 4.1 Pattern (Host‑Page verdrahtet Viewer‑Resident in Lines) Annahmen: Ihre Header‑Page hat: part(SQZViewer; "DXP SQZ Viewer Part") part(DocumentLines; ) Ihre Lines‑ListPart stellt eine Procedure bereit: SetViewerResident(var NewResident: Codeunit "DXP SQUEEZE Viewer Resident") Das ist ein expliziter Vertrag/Annahme für interaktives Line‑Highlighting. Ergänzen Sie das auf Ihrer Header‑Page: trigger OnAfterGetCurrRecord() var SharedResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin CurrPage.SQZViewer.Page.GetViewerResident(SharedResident); CurrPage.DocumentLines.Page.SetViewerResident(SharedResident); end; Hinweise: Das gehört in  OnAfterGetCurrRecord() der Host‑Page (dort ist der aktuelle Header stabil, und die Parts existieren). Wenn Ihre Host‑Page andere Part‑Namen verwendet, passen Sie  CurrPage..Page... entsprechend an. 4.2 Was die Lines‑Subform tun muss Ihre Lines‑Page sollte  MarkRow() in  OnAfterGetCurrRecord() aufrufen und  MarkRow() ähnlich zur Standard‑Seite implementieren: Wenn der externe Viewer aktiv ist (Abgedockt), nur die State‑Tabelle aktualisieren. Ansonsten  ApiMgt.PostMessage(ApiMgt.MarkFieldByCoordinatesObj(Rec.RecordId), Resident) aufrufen. Das ist die Mindestanforderung für interaktives Highlighting. 4.3 Referenz‑Implementierung: minimale Lines‑Subform mit  MarkRow Das ist ein bekannt funktionierendes Minimal‑Pattern (basierend auf der Standard SQUEEZE Lines‑Subform). Third‑party Entwickler können es kopieren und Felder/Repeater‑Spalten nach Bedarf anpassen: page 70954672 "DXP SQZ Doc. Generic Subform" { Caption = 'Lines'; PageType = ListPart; AutoSplitKey = true; DelayedInsert = true; SourceTable = "DXP SQZ Document Line"; RefreshOnActivate = true; layout { area(content) { repeater(General) { field("Line No."; Rec."Line No.") { ApplicationArea = All; Visible = false; } // Add your visible SQZ fields here... } } } trigger OnAfterGetCurrRecord() begin MarkRow(); end; var ApiMgt: Codeunit "DXP SQZ API Mgt."; Resident: Codeunit "DXP SQUEEZE Viewer Resident"; MarkedLineNo: Integer; procedure SetViewerResident(var NewResident: Codeunit "DXP SQUEEZE Viewer Resident") begin Resident := NewResident; MarkedLineNo := 0; end; local procedure MarkRow() var DocHeader: Record "DXP SQZ Document Header"; LineCoordMgt: Codeunit "DXP SQZ Coordinates Mgt."; ViewerState: Codeunit "DXP Viewer State"; begin if MarkedLineNo = Rec."Line No." then exit; if not LineCoordMgt.CoordinateExists(Rec.RecordId) then exit; // Detached viewer: update the state table only if IsExternalViewerActive() then begin if DocHeader.Get(Rec."Document No.") then ViewerState.UpdateViewerStateWithCoordinates(DocHeader."API Document ID", Rec.RecordId); end else // Internal viewer: post message to the control add-in instance via the shared resident ApiMgt.PostMessage(ApiMgt.MarkFieldByCoordinatesObj(Rec.RecordId), Resident); MarkedLineNo := Rec."Line No."; end; local procedure IsExternalViewerActive(): Boolean var ViewerState: Codeunit "DXP Viewer State"; begin exit(ViewerState.GetViewerMode() = "DXP SQZ Viewer Mode"::Detached); end; } 5) Fehlersuche (Viewer bleibt leer) 5.1 Der Viewer lädt nie eine Preview Prüfe zuerst: Ist das SQUEEZE Modul aktiviert und das Setup vollständig? Hat der verknüpfte DXP SQZ Document Header Datensatz eine gültige  "API Document ID"? Ist der Viewer‑Modus aktuell Abgedockt und ein externer Viewer offen? Der interne Viewer lädt nicht, solange der externe Viewer geöffnet ist. 5.2 FactBox ist sichtbar, aber Control Add-in initialisiert nicht Deaktiviere den Viewer‑FactBox‑Part nicht über  Enabled = false. Stelle sicher, dass die FactBox tatsächlich angezeigt wird (FactBoxes können vom Benutzer eingeklappt/ausgeblendet werden). 5.3 MarkRow hebt nichts hervor Stelle sicher, dass die Lines‑Page dieselbe Viewer‑Resident‑Instanz wie der Viewer‑Part nutzt (siehe Abschnitt 4). Stelle sicher, dass Koordinaten für den Zeilen‑Datensatz existieren ( DXP SQZ Coordinates Mgt. muss Koordinaten zu  Rec.RecordId finden). 6) Minimales Beispiel: Viewer in eine eigene Page Extension einbauen pageextension 50100 "MY SQZ Doc Ext." extends "DXP SQZ Document (Generic)" { layout { addfirst(FactBoxes) { part(MySQZViewer; "DXP SQZ Viewer Part") { ApplicationArea = All; Caption = 'Viewer'; SubPageLink = "No." = field("No."); } } } } 7) Hinweise / Einschränkungen Der Viewer‑State ist session‑getrieben (via  DXP Viewer State). Wenn mehrere Seiten mit Viewer gleichzeitig offen sind, können Modus/External‑Viewer‑State alle beeinflussen. Der Viewer‑Part ist für Datensätze mit SQUEEZE‑Bezug gedacht; er versucht nicht, automatisch „irgendeinen“ Header zu suchen. 8) Beispiel: Viewer auf einem Zielbeleg anzeigen (Purchase Invoice) Dieser Abschnitt adressiert ein häufiges Third‑party Szenario: Annahmen: Der Zielbeleg (z. B. Purchase Invoice) wurde aus einem Core‑Beleg erstellt. Der Core‑Beleg ist weiterhin in der Tabelle "DXP Document" verfügbar. Der Core‑Beleg speichert eine Rückverknüpfung zum Ziel‑Datensatz im Feld "Linked-to Record Id". Der SQUEEZE Quell‑Header existiert noch und kann aus dem Core‑Beleg aufgelöst werden (typischerweise über Core Document No.). 8.1 Core‑Beleg aus dem Ziel‑Datensatz auflösen local procedure TryGetCoreDocumentForTarget(TargetRecId: RecordId; var CoreDoc: Record "DXP Document"): Boolean begin CoreDoc.Reset(); CoreDoc.SetRange("Linked-to Record Id", TargetRecId); exit(CoreDoc.FindFirst()); end; 8.2 SQUEEZE Header aus dem Core‑Beleg auflösen local procedure TryGetSqzHeaderForCore(CoreDocNo: Code[20]; var SqzHeader: Record "DXP SQZ Document Header"): Boolean begin SqzHeader.Reset(); SqzHeader.SetRange("Core Document No.", CoreDocNo); exit(SqzHeader.FindFirst()); end; 8.3 Viewer einbetten (dynamisches Binden) Beispiel: Purchase Invoice erweitern (konzeptionell; Basis‑Page‑Name ggf. an Ihre Umgebung anpassen). Diese Implementierung verwendet: Einen FactBox‑Part Ein  ShowViewer‑Flag, um den Part auszublenden, wenn kein SQZ Header aufgelöst werden kann. SetSqzRecord(...), damit die Preview beim Wechsel des Belegs sofort korrekt neu lädt. Ein  SingleInstance Context‑Codeunit, um Viewer‑Resident und SQZ‑Kontext mit der Purch. Invoice Subform zu teilen (FactBoxes und Subforms sind separate Pages). pageextension 50100 "MY Purch. Invoice Viewer" extends "Purchase Invoice" { layout { addfirst(FactBoxes) { part(DXPSQZViewer; "DXP SQZ Viewer Part") { ApplicationArea = All; Caption = 'SQUEEZE Viewer'; Visible = ShowViewer; } } } var ShowViewer: Boolean; trigger OnAfterGetCurrRecord() var CoreDoc: Record "DXP Document"; SqzHeader: Record "DXP SQZ Document Header"; SharedResident: Codeunit "DXP SQUEEZE Viewer Resident"; ViewerCtx: Codeunit "DXP SQZ Purch. Inv. Viewer Ctx"; begin ShowViewer := false; if not TryGetCoreDocumentForTarget(Rec.RecordId, CoreDoc) then exit; if not TryGetSqzHeaderForCore(CoreDoc."No.", SqzHeader) then exit; ShowViewer := true; CurrPage.DXPSQZViewer.Page.SetSqzRecord(SqzHeader); CurrPage.DXPSQZViewer.Page.GetViewerResident(SharedResident); ViewerCtx.SetResident(SharedResident); ViewerCtx.SetSqzContextForPurchInv(Rec."No.", SqzHeader."No.", SqzHeader."API Document ID"); end; local procedure TryGetCoreDocumentForTarget(TargetRecId: RecordId; var CoreDoc: Record "DXP Document"): Boolean begin CoreDoc.Reset(); CoreDoc.SetRange("Linked-to Record Id", TargetRecId); exit(CoreDoc.FindFirst()); end; local procedure TryGetSqzHeaderForCore(CoreDocNo: Code[20]; var SqzHeader: Record "DXP SQZ Document Header"): Boolean begin SqzHeader.Reset(); SqzHeader.SetRange("Core Document No.", CoreDocNo); exit(SqzHeader.FindFirst()); end; } Zugehöriges Context‑Codeunit (speichert Resident + SQZ‑Kontext, damit die Subform korrekt highlighten kann): codeunit 50101 "MY SQZ Purch. Inv. Viewer Ctx" { SingleInstance = true; procedure SetResident(var NewResident: Codeunit "DXP SQUEEZE Viewer Resident") begin Resident := NewResident; HasResident := true; end; procedure TryGetResident(var OutResident: Codeunit "DXP SQUEEZE Viewer Resident"): Boolean begin if not HasResident then exit(false); OutResident := Resident; exit(true); end; procedure SetSqzContextForPurchInv(PurchInvNo: Code[20]; SqzDocNo: Code[20]; ApiDocumentId: Text[50]) begin PurchInvToSqzDocNo.Set(PurchInvNo, SqzDocNo); PurchInvToApiDocumentId.Set(PurchInvNo, ApiDocumentId); end; procedure TryGetSqzContextForPurchInv(PurchInvNo: Code[20]; var SqzDocNo: Code[20]; var ApiDocumentId: Text[50]): Boolean begin if not PurchInvToSqzDocNo.Get(PurchInvNo, SqzDocNo) then exit(false); PurchInvToApiDocumentId.Get(PurchInvNo, ApiDocumentId); exit(true); end; var Resident: Codeunit "DXP SQUEEZE Viewer Resident"; HasResident: Boolean; PurchInvToSqzDocNo: Dictionary of [Code[20], Code[20]]; PurchInvToApiDocumentId: Dictionary of [Code[20], Text[50]]; } 8.4 Wichtiger Hinweis: SQUEEZE Header‑Status nach Verarbeitung Sie haben ein häufiges Setup beschrieben, in dem der SQUEEZE Header nach dem Erstellen des Zielbelegs noch existiert, aber  Status = Deleted ist. Der Viewer‑Part kann die Preview trotzdem laden, solange  "API Document ID" vorhanden ist und SQUEEZE aktiviert ist. Optionen: Wenn Sie die Preview nach Zielbeleg‑Erstellung nicht anzeigen möchten, bauen Sie eine Guard‑Logik auf der Host‑Page ein (Viewer‑Part dann nicht binden, wenn der SQZ Header „Deleted“ ist). Welche Option korrekt ist, hängt von Ihren Prozessanforderungen ab. 9) Sonderfall: Hervorheben aus der Purchase Invoice Subform (Purchase Line → SQZ line) Manchmal mächten Sie diese Benutzererfahrung auf einer Zielbeleg‑Seite: User navigiert durch Purchase Lines. Der eingebettete SQUEEZE Viewer hebt den entsprechenden Bereich (Koordinaten) des originalen Belegs, bzw. der Viewer-Abbildung hervor. In dieser Situation basiert Ihre Lines‑Page nicht auf  "DXP SQZ Document Line", daher können Sie  MarkFieldByCoordinatesObj(Rec.RecordId) nicht direkt aufrufen. Stattdessen müssen Sie die passende SQUEEZE Line auflösen und danach mit der  RecordId dieser SQUEEZE Line highlighten. 9.1 Zwei mögliche Verknüpfungsstrategien Es gibt zwei realistische Wege, eine Einkaufszeile wieder auf eine SQUEEZE Line zu mappen: Expliziter Allocation‑Link (nur in manchen Szenarien verfügbar) Verwendet Felder auf  "DXP SQZ Document Line": "Allocated Document Type" (enum  "DXP Order Match Document Type") "Allocated Document No." "Allocated Document Line No." Heuristischer Match nach Inhalt (empfohlen als Fallback) Verwendet Felder, die typischerweise auf beiden Seiten existieren (Type/No/Quantity/Unit Cost/Line Amount/Description). Das funktioniert auch dann, wenn keine Allocation‑Beziehung gepflegt wird. Es ist nicht mathematisch perfekt (Duplikate sind möglich), daher sollten Matching‑Regeln auf Ihren Use Case angepasst werden. 9.2 Empfohlenes Wiring (Host‑Page übergibt SQZ‑Kontext + Resident) Sie benötigen in der Purchase‑Lines‑Subpage zwei Dinge: Den Viewer‑Resident (damit  PostMessage(...) die richtige Control‑Add‑in Instanz trifft) Den aktuellen SQZ Header‑Kontext (damit Sie SQZ Lines auf das richtige Dokument filtern) Empfohlenes Pattern auf der Host‑Page (nachdem Sie  SqzHeader aufgelöst haben): trigger OnAfterGetCurrRecord() var SharedResident: Codeunit "DXP SQUEEZE Viewer Resident"; SqzHeader: Record "DXP SQZ Document Header"; begin if not TryResolveSqzHeaderForCurrentRecord(SqzHeader) then exit; CurrPage.DXPSQZViewer.Page.SetSqzRecord(SqzHeader); CurrPage.DXPSQZViewer.Page.GetViewerResident(SharedResident); ViewerCtx.SetResident(SharedResident); ViewerCtx.SetSqzContextForPurchInv(Rec."No.", SqzHeader."No.", SqzHeader."API Document ID"); end; 9.3 Minimales Beispiel: Purch. Invoice Subform triggert Highlighting im Viewer Dieses Beispiel erweitert Purch. Invoice Subform. Beachten Sie: der Datensatz der Basis‑Subform ist ein  Record "Purchase Line", daher müssen die Resolver‑Prozeduren  Record "Purchase Line" akzeptieren. Das hier gezeigte Allocation‑Mapping ist die funktionierende Implementierung für Purchase‑Invoice‑Szenarien: es verknüpft über Receipt ( "Receipt No." /  "Receipt Line No.") statt über Belegnummer/Zeilennummer der Rechnung. pageextension 50101 "MY Purch. Inv. Sf Mark" extends "Purch. Invoice Subform" { trigger OnAfterGetCurrRecord() begin MarkSqzLineForPurchInvLine(); end; var ApiMgt: Codeunit "DXP SQZ API Mgt."; Resident: Codeunit "DXP SQUEEZE Viewer Resident"; ViewerState: Codeunit "DXP Viewer State"; LineCoordMgt: Codeunit "DXP SQZ Coordinates Mgt."; ViewerCtx: Codeunit "DXP SQZ Purch. Inv. Viewer Ctx"; SqzDocNo: Code[20]; ApiDocumentId: Text[50]; local procedure MarkSqzLineForPurchInvLine() var SqzLine: Record "DXP SQZ Document Line"; begin if not ViewerCtx.TryGetSqzContextForPurchInv(Rec."Document No.", SqzDocNo, ApiDocumentId) then exit; if not ViewerCtx.TryGetResident(Resident) then exit; if not TryResolveSqzLineForPurchLine(SqzDocNo, Rec, SqzLine) then exit; if not LineCoordMgt.CoordinateExists(SqzLine.RecordId) then exit; if ViewerState.GetViewerMode() = "DXP SQZ Viewer Mode"::Detached then ViewerState.UpdateViewerStateWithCoordinates(ApiDocumentId, SqzLine.RecordId) else ApiMgt.PostMessage(ApiMgt.MarkFieldByCoordinatesObj(SqzLine.RecordId), Resident); end; local procedure TryResolveSqzLineForPurchLine(SqzDocNo: Code[20]; PurchLine: Record "Purchase Line"; var SqzLine: Record "DXP SQZ Document Line"): Boolean begin // 1) Allocation link via receipt (Purchase Invoice Szenario) SqzLine.Reset(); SqzLine.SetRange("Document No.", SqzDocNo); SqzLine.SetFilter("Allocated Document No.", '%1&<>%2', PurchLine."Receipt No.", ''); SqzLine.SetFilter("Allocated Document Line No.", '%1&<>%2', PurchLine."Receipt Line No.", 0); if SqzLine.FindFirst() then exit(true); // 2) Fallback: content-based match (Type/No/Amounts) exit(TryResolveSqzLineByContent(SqzDocNo, PurchLine, SqzLine)); end; local procedure TryResolveSqzLineByContent(SqzDocNo: Code[20]; PurchLine: Record "Purchase Line"; var BestSqzLine: Record "DXP SQZ Document Line"): Boolean var Candidate: Record "DXP SQZ Document Line"; BestScore: Integer; Score: Integer; QtyTol: Decimal; AmtTol: Decimal; begin QtyTol := 0.00001; AmtTol := 0.01; BestScore := 0; Candidate.Reset(); Candidate.SetRange("Document No.", SqzDocNo); // Prefer narrowing early on stable fields Candidate.SetRange(Type, PurchLine.Type); if PurchLine."No." <> '' then Candidate.SetRange("No.", PurchLine."No."); if not Candidate.FindSet() then exit(false); repeat Score := 0; // Strong signals if Candidate.Type = PurchLine.Type then Score += 20; if (PurchLine."No." <> '') and (Candidate."No." = PurchLine."No.") then Score += 40; // Weak/medium signals (tolerant) if (Candidate.Quantity <> 0) and (Abs(Candidate.Quantity - PurchLine.Quantity) <= QtyTol) then Score += 10; if (Candidate."Direct Unit Cost" <> 0) and (Abs(Candidate."Direct Unit Cost" - PurchLine."Direct Unit Cost") <= AmtTol) then Score += 10; if (Candidate."Line Amount" <> 0) and (Abs(Candidate."Line Amount" - PurchLine."Line Amount") <= AmtTol) then Score += 10; if (Candidate.Description <> '') and (PurchLine.Description <> '') and (Candidate.Description = PurchLine.Description) then Score += 5; if Score > BestScore then begin BestScore := Score; BestSqzLine := Candidate; end; until Candidate.Next() = 0; // Guard: avoid picking a random line when nothing matches well. exit(BestScore >= 30); end; } Events after creating a SQUEEZE document (CreateSource) Audience This documentation is intended for third-party developers who want to extend the creation process of a SQUEEZE document (tables DXP SQZ Document Header/ DXP SQZ Document Line). The focus is on the integration events that are raised after or during ISourceDocument.CreateSource(...). Context: where is CreateSource called? The entry point for the SQUEEZE integration is in the DXP SQZ API Mgt. codeunit: A Core document ( DXP Document) is created (via DXP Document Mgt.). The DXP ISource Document interface is then resolved via the document class and CreateSource(Document) is executed. Simplified flow (from CreateCoreAndSQUEEZEDocument): DocumentMgt.AddDocument(DocClass, ...) (create the Core document) ISourceDocument.CreateSource(Document) (create the SQUEEZE document) Process the import queue / "finish" the SQUEEZE document Document classes & default behavior Which CreateSource implementation is executed is defined in the enum extension DXP Document Class Ext.. DXP Invoice / Credit Memo → codeunit DXP SQZ P. Inv/Crdt Memo Impl. DXP Order Confirmation → codeunit DXP SQZ P. Order Conf. Impl. Default (when no specific implementation is set): The DXP Document Class enum defines a DefaultImplementation on DXP Source Document Def. Impl.. This default implementation: does not create a SQUEEZE document, CreateSource(...) returns false. Common pipeline inside CreateSource Both SQUEEZE implementations follow (in short) this pattern: Guard: the Core document must have Status = Imported and JSON Raw must exist. DXP SQZ Document Mgt.: CreateSQUEEZEDocHeader(Document, DocHeader, RawJson) CreateSQUEEZEDocLine(DocHeader, RawJson) DXP Document Mgt.: UpdateDocumentAfterTransfer(...) (set the Core document to "Transferred" and link it to the SQZ header) Order match / autocomplete / attachments / validation (depending on document class and setup) The most important events are therefore attached to: the header/line creation in DXP SQZ Document Mgt. the completion of the CreateSource procedure in the respective implementations optional steps such as order match or validation Event matrix (short overview) Area Event Timing Control Typical use cases DXP SQZ API Mgt. OnAfterInitMapping(...) after initializing the mapping/token context – extend/check mapping DXP SQZ API Mgt. OnAfterSaveAttachment(...) after an attachment has been saved successfully – post-processing/indexing DXP SQZ API Mgt. OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment(...) before the attachment record is modified – influence file name/origin DXP SQZ P. Inv/Crdt Memo Impl. OnAfterCreateDocLines directly after CreateSQUEEZEDocLine(...) – evaluate lines/RawJson after creation DXP SQZ P. Inv/Crdt Memo Impl. OnAfterCreateSource at the end of CreateSource(...) – post actions after autocomplete/order match/validation DXP SQZ P. Inv/Crdt Memo Impl. OnBeforeDoPlausibilityChecks before the plausibility checks IsHandled replace/extend checks DXP SQZ P. Inv/Crdt Memo Impl. OnAfterDoPlausibilityChecks after the plausibility checks – reuse the result (entries) DXP SQZ P. Order Conf. Impl. OnBeforeDoPlausibilityChecks before the plausibility checks IsHandled replace/extend checks DXP SQZ Document Mgt. OnBeforeModifySQUEEZEDocumentHeader in CreateSQUEEZEDocHeader(...) before the final modify – add/normalize header values from RawJson DXP SQZ Document Mgt. OnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues in standard line post-processing before TransferRecognizedValues – correct recognized values per line DXP SQZ Document Mgt. OnAfterTransferRecognizedValuesOnBeforeInsertDocLine in standard line post-processing after TransferRecognizedValues – line-based derivations (account assignment/dimensions) DXP SQZ Document Mgt. OnBeforePerformAutomaticOrdermatch before the automatic order match IsHandled take over order match completely/adjust OrderNoList JSON creation OnBeforeAddLineToDocumentJObj before the line structure is built – extend the header JSON JSON creation OnBeforeAddLineJObjToLineJArray before LineJArray.Add(LineJObj) – extend the line JSON Events in DXP SQZ P. Inv/Crdt Memo Impl. (document class: Invoice / Credit Memo) This codeunit provides the strongest extension points directly in the CreateSource flow. OnAfterCreateDocLines Raised directly after CreateSQUEEZEDocLine(...) (that is, once the header & lines exist). Signature: [IntegrationEvent(false, false)] local procedure OnAfterCreateDocLines(DocHeader: Record "DXP SQZ Document Header"; RawJson: JsonObject) Typical use cases: additional header initialization (for example custom flags/fields) additional line-based evaluations directly after creation extract custom metadata from RawJson OnAfterCreateSource Raised at the end of CreateSource(...) (after autocomplete/order match/optional attachment download/optional auto-validate). Signature: [IntegrationEvent(false, false)] local procedure OnAfterCreateSource(DocHeader: Record "DXP SQZ Document Header"; RawJson: JsonObject) Typical use cases: start downstream automations (workflows, notifications) additional data validation or custom status logic Plausibility check events These events relate to the IsSourceDataPlausible(...) method and are relevant if you extend/replace plausibility checks. Signatures (excerpt): [IntegrationEvent(false, false)] local procedure OnBeforeDoPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var TempPlausibilityCheckEntry: Record "DXP Plausibility Check Entry" temporary; var IsHandled: Boolean) [IntegrationEvent(false, false)] local procedure OnBeforeDoHeaderPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") [IntegrationEvent(false, false)] local procedure OnBeforeDoLinePlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; DocLine: Record "DXP SQZ Document Line"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") [IntegrationEvent(false, false)] local procedure OnAfterDoPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var TempPlausibilityCheckEntry: Record "DXP Plausibility Check Entry" temporary) JSON creation (Processed JSON from the SQZ document) The implementation contains events before line JSON is added to the header structure: OnBeforeAddLineToDocumentJObj [IntegrationEvent(false, false)] local procedure OnBeforeAddLineToDocumentJObj(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") OnBeforeAddLineJObjToLineJArray [IntegrationEvent(false, false)] local procedure OnBeforeAddLineJObjToLineJArray(var LineJObj: JsonObject; DocLine: Record "DXP SQZ Document Line") Use cases: write additional fields into the header JSON add additional fields per line (custom tokens) Events in DXP SQZ P. Order Conf. Impl. (document class: Order Confirmation) This codeunit has no dedicated OnAfterCreateSource events in CreateSource(...). Extensions here typically happen via: DXP SQZ Document Mgt. (header/line creation, order match) the JSON creation ( CreateProcessedJsonFromSource) plausibility check events JSON creation [IntegrationEvent(false, false)] local procedure OnBeforeAddLineToDocumentJObj(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") [IntegrationEvent(false, false)] local procedure OnBeforeAddLineJObjToLineJArray(var LineJObj: JsonObject; DocLine: Record "DXP SQZ Document Line") Plausibility check events Analogous to the Invoice/Credit Memo implementation: OnBeforeDoPlausibilityChecks OnBeforeDoHeaderPlausibilityChecks OnBeforeDoLinePlausibilityChecks OnAfterDoPlausibilityChecks Events in DXP SQZ Document Mgt. (common to all document classes) These events are especially relevant because they are raised within the header/line creation and order match pipeline. OnBeforeModifySQUEEZEDocumentHeader Raised in CreateSQUEEZEDocHeader(...), after values have been assigned via field mapping and before the header is finally modified. Signature: [IntegrationEvent(false, false)] local procedure OnBeforeModifySQUEEZEDocumentHeader(var DocHeader: Record "DXP SQZ Document Header"; RawJson: JsonObject) Use cases: adjust header fields before the standard post-processing runs take additional values from RawJson into the header OnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues OnAfterTransferRecognizedValuesOnBeforeInsertDocLine Raised in the standard line post-processing (for standard document classes) around TransferRecognizedValues(DocLine). Signatures: [IntegrationEvent(false, false)] local procedure OnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues(var DocLine: Record "DXP SQZ Document Line"; RowJTok: JsonToken) [IntegrationEvent(false, false)] local procedure OnAfterTransferRecognizedValuesOnBeforeInsertDocLine(var DocLine: Record "DXP SQZ Document Line") Use cases: correct/normalize recognized values per line prepare additional derivations (for example account assignment, dimensions) OnBeforePerformAutomaticOrdermatch Raised in PerformAutomaticOrdermatch(...), after the order number list ( OrderNoList) has been filled and before the automatic order match runs. Signature: [IntegrationEvent(false, false)] local procedure OnBeforePerformAutomaticOrdermatch(DocHeader: Record "DXP SQZ Document Header"; var OrderNoList: List of [Code[20]]; var IsHandled: Boolean) Use cases: take over the automatic order match logic completely ( IsHandled := true) adjust the OrderNoList (for example filter/extend) Events in DXP SQZ API Mgt. (close to creation/attachments) These events sit "around" the API communication (for example attachments). OnAfterInitMapping Raised in DownloadFieldMapping(...), after the document class has initialized the default mapping via the DXP ISource Document interface ( ISourceDocument.InitFieldMapping(...)) and before the field list from SQUEEZE is synchronized into the BC field mapping structures. Signature: [IntegrationEvent(false, false)] local procedure OnAfterInitMapping(var HeaderMapping: Dictionary of [Text, Integer]; var LineMapping: Dictionary of [Text, Integer]; DocClass: Enum "DXP Document Class") Parameters: HeaderMapping / LineMapping: dictionaries with the default mapping SQZ field name → BC field no. (modifiable via var) DocClass: the document class for which the mapping is loaded Typical use cases: add additional (customer-specific) field names as default mapping correct the default mapping (for example when SQZ field names have changed) mapping validation/logging per document class OnAfterSaveAttachment Raised in SaveAttachments(...) per attachment, after the attachment has been created via DXP Document Attachment Mgt. and – if the attachment is marked as origin file – after the Modify(true) of the record. Signature: [IntegrationEvent(false, false)] local procedure OnAfterSaveAttachment(DocumentAttachment: Record "DXP Document Attachment") DocumentAttachment is not passed as var. If you want to change fields on the record persistently, you must reload the record in the subscriber and explicitly call Modify(...). Typical use cases: index/archive the attachment externally derive metadata (for example classification by MIME type/file extension) trigger follow-up processes (for example OCR/preview generation in a third-party system) OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment Raised in SaveAttachments(...), when the attachment is marked as origin file according to the payload and after Is Source File and File Name (origin name) have been set – but before DocumentAttachment.Modify(true) is called. Signature: [IntegrationEvent(false, false)] local procedure OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment(var DocumentAttachment: Record "DXP Document Attachment") Typical use cases: normalize the origin file name (for example remove forbidden characters, enforce a naming scheme) set additional fields on the attachment before it is saved Minimal examples: EventSubscriber for DXP SQZ API Mgt. The following examples show typical, small extensions. Adjust the object IDs/names to your namespace. codeunit 50101 "My SQZ API Mgt. Subs" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterInitMapping', '', false, false)] local procedure OnAfterInitMapping(var HeaderMapping: Dictionary of [Text, Integer]; var LineMapping: Dictionary of [Text, Integer]; DocClass: Enum "DXP Document Class") var SqzDocHeader: Record "DXP SQZ Document Header"; SqzDocLine: Record "DXP SQZ Document Line"; begin // Example: add a new SQZ field as default mapping. // Important: The integer value is the BC field no. of the target field (depends on your mapping concept). if not HeaderMapping.ContainsKey('my_custom_header_token') then HeaderMapping.Add('my_custom_header_token', SqzDocHeader.FieldNo("Vendor No.")); if not LineMapping.ContainsKey('my_custom_line_token') then LineMapping.Add('my_custom_line_token', SqzDocLine.FieldNo(Description)); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment', '', false, false)] local procedure OnAfterSetOriginFileNameOnBeforeModifyDocumentAttachment(var DocumentAttachment: Record "DXP Document Attachment") begin // Example: normalize the origin file name (remove whitespace). DocumentAttachment."File Name" := DelChr(DocumentAttachment."File Name", '=', ' '); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterSaveAttachment', '', false, false)] local procedure OnAfterSaveAttachment(DocumentAttachment: Record "DXP Document Attachment") begin // Example: kick off post-processing. // If you want to change the attachment persistently, you can also modify the parameter record directly. // DocumentAttachment.Validate("Your Field", ...); // DocumentAttachment.Modify(true); end; } Events after creating a Core document (DXP Document) Audience This documentation is intended for third-party developers who want to extend the lifecycle of the Core document DXP Document – in particular at the points where: the status / "Next Process Step" is evaluated, JSON Raw / JSON Processed is updated, standard documents are created (for example purchase documents), attachments are transferred. Context: Core document creation vs. further processing 1) The Core document is created ( AddDocument) A DXP Document is created in DXP Document Mgt. via AddDocument(...): The status is set to Imported. JSON Raw is written (if present) to a BLOB field. 2) Afterwards: transfer/linking and processing Typical next steps (depending on the app flow): Linking to a source document (for example a SQUEEZE header) via UpdateDocumentAfterTransfer(...) Creating a standard document and writing JSON Processed via UpdateDocument(...) Most extension points are therefore not directly at the insert, but in the update/processing flow. Event matrix (short overview) Area Event Timing Control Typical use cases DXP Document Mgt. OnAfterSetLinkedToRecIdOnBeforeModify in UpdateDocumentAfterTransfer(...) before Modify(true) – set additional info as soon as Linked-to Record Id is set DXP Document Mgt. OnBeforeGetDocumentOnBeforeCheckStatusAndNextProcessStep early in UpdateDocument(...) before Document.Get(DocNo) IsHandled overwrite status/next step, take over processing DXP Document Mgt. OnAfterGetDocumentOnBeforeCheckStatusAndNextProcessStep in UpdateDocument(...) after Get(...) before standard document creation Handled decide depending on the document, adjust JSON/status DXP Document Mgt. OnAfterUpdateRawJson after writing JSON Raw in UpdateRawJsonJson(...) – normalize raw JSON/additional derivations DXP Document Mgt. OnAfterWriteProcessedJsonToBlob after writing JSON Processed in UpdateStatusAndProcessedJson(...) – finalize processed JSON, add tokens DXP Document Mgt. OnBeforeTransferCoreAttachmentsToStandardDocument before the attachment transfer IsHandled replace/selectively control the transfer DXP Document Transfer Mgt. OnBeforeExitProcessedJsonDocHeader when creating header JSON (before exit(JObject)) – add/normalize standard tokens DXP Document Transfer Mgt. OnBeforeExitProcessedJsonDocLine when creating line JSON (before exit(JObject)) – add/normalize line tokens DXP Document Transfer Mgt. OnAfterCreatePurchaseHeader after creating/validating the purchase header – add header fields, post-processing DXP Document Transfer Mgt. OnBeforeInsertPurchaseLine before inserting a purchase line – adjust purchase line (for example account assignment, type/no.) DXP Document Transfer Mgt. OnAfterInsertPurchaseLineOnBeforeAddDimensions after insert, before dimensions – prepare dimensions/additional info DXP Document Transfer Mgt. OnAfterOnBeforeAddLineDimensions for receipt lines: before the dimensions of the line to be updated – adjust update cases (receipt) DXP Document Transfer Mgt. OnAfterProcessAdditionalInformation after transferring additional information – add add-on fields per target RecordRef DXP Document Transfer Mgt. OnAfterCreatePurchaseDoc after the complete creation of the purchase document – final hook (logging, follow-up actions) Events in DXP Document Mgt. (Core lifecycle) OnAfterSetLinkedToRecIdOnBeforeModify Raised in UpdateDocumentAfterTransfer(...) – after the status/ Linked-to Record Id have been set, but before the DXP Document is saved. Signature: [IntegrationEvent(false, false)] local procedure OnAfterSetLinkedToRecIdOnBeforeModify(var Document: Record "DXP Document") Use cases: set additional information on the Core document as soon as it is linked to a source document add your own logging/audit information OnBeforeGetDocumentOnBeforeCheckStatusAndNextProcessStep Called in UpdateDocument(...) as the earliest hook – even before the DXP Document is loaded via Get(DocNo). Signature: [IntegrationEvent(false, false)] local procedure OnBeforeGetDocumentOnBeforeCheckStatusAndNextProcessStep( DocNo: Code[20]; var Status: Enum "DXP Document Status"; var NextStep: Enum "DXP Next Process Step"; JObject: JsonObject; var IsHandled: Boolean) Use cases: overwrite status/next step in advance (for example "Custom Processing") take over the complete processing ( IsHandled := true) OnAfterGetDocumentOnBeforeCheckStatusAndNextProcessStep Raised in UpdateDocument(...) after Document.Get(DocNo), before standard documents are created. Signature: [IntegrationEvent(false, false)] local procedure OnAfterGetDocumentOnBeforeCheckStatusAndNextProcessStep( var Document: Record "DXP Document"; NewStatus: Enum "DXP Document Status"; NextStep: Enum "DXP Next process step"; var ProcessedJSONObj: JsonObject; var Handled: Boolean) Use cases: decide, depending on the current Core document, whether processing should be taken over adjust the ProcessedJSONObj before further processing OnAfterUpdateRawJson Raised in UpdateRawJsonJson(...) after writing JSON Raw. Signature: [IntegrationEvent(false, false)] local procedure OnAfterUpdateRawJson(var Document: Record "DXP Document"; var RawJSONObj: JsonObject) Use cases: validation/normalization steps on RawJSONObj additional data extraction directly after the raw update OnAfterWriteProcessedJsonToBlob Raised in UpdateStatusAndProcessedJson(...) after JSON Processed has been written to the BLOB. Signature: [IntegrationEvent(false, false)] local procedure OnAfterWriteProcessedJsonToBlob(var Document: Record "DXP Document"; var ProcessedJSONObj: JsonObject) Use cases: add additional tokens finalize the data structure before downstream processes access it OnBeforeTransferCoreAttachmentsToStandardDocument Raised in TransferCoreAttachmentsToStandardDocument(...) before the transfer. The standard logic can be replaced via IsHandled. Signature: [IntegrationEvent(false, false)] local procedure OnBeforeTransferCoreAttachmentsToStandardDocument(Document: Record "DXP Document"; var IsHandled: Boolean) Use cases: take over the attachment transfer completely (for example different storage/naming) restrict the transfer selectively Events in DXP Document Transfer Mgt. (standard documents from JSON Processed) This codeunit is relevant as soon as standard documents (for example purchase documents) are created from JSON Processed. OnBeforeExitProcessedJsonDocHeader Raised in CreateDocHeaderJson(...) immediately before exit(JObject). Signature: [IntegrationEvent(false, false)] local procedure OnBeforeExitProcessedJsonDocHeader(var JObject: JsonObject) Use cases: add additional standard tokens normalize token values (for example type/text representation) OnBeforeExitProcessedJsonDocLine Raised in CreateDocLineJson(...) immediately before exit(JObject). Signature: [IntegrationEvent(false, false)] local procedure OnBeforeExitProcessedJsonDocLine(var JObject: JsonObject) Use cases: add/normalize line tokens OnAfterCreatePurchaseHeader Raised after the purchase header is created/validated. Signature: [IntegrationEvent(false, false)] local procedure OnAfterCreatePurchaseHeader(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") Use cases: set additional fields on the Purchase Header (for example custom references) post-processing/logging OnBeforeInsertPurchaseLine Raised immediately before a purchase line is inserted. Signature: [IntegrationEvent(false, false)] local procedure OnBeforeInsertPurchaseLine(var JObjectLine: JsonObject; var PurchaseLine: Record "Purchase Line") Use cases: adjust the purchase line (for example account assignment, type/no.) OnAfterInsertPurchaseLineOnBeforeAddDimensions Raised after the purchase line is inserted, but before dimension validation. Signature: [IntegrationEvent(false, false)] local procedure OnAfterInsertPurchaseLineOnBeforeAddDimensions(var JObjectLine: JsonObject; PurchaseLine: Record "Purchase Line") Use cases: prepare dimensions/additional info OnAfterOnBeforeAddLineDimensions Raised in the receipt line update case, before dimensions are set for the purchase line to be updated. Signature: [IntegrationEvent(false, false)] local procedure OnAfterOnBeforeAddLineDimensions(var JObjectLine: JsonObject; PurchaseLineToUpdate: Record "Purchase Line") Use cases: adjust update cases (receipt) OnAfterProcessAdditionalInformation Raised after the transfer of additional information ( ProcessAdditionalInformation). Signature: [IntegrationEvent(false, false)] local procedure OnAfterProcessAdditionalInformation(var RecRef: RecordRef; SourceJsonObject: JsonObject) Use cases: add add-on fields for different target tables (header/line) OnAfterCreatePurchaseDoc Raised after the complete creation of the purchase document. Signature: [IntegrationEvent(false, false)] local procedure OnAfterCreatePurchaseDoc(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") Use cases: final hook (post-processing, logging, follow-up actions) Minimal example: influencing status/next step toward "Custom Processing" Example: set Status to "Custom Processing" before the standard processing: codeunit 50101 "My Core Document Hooks" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Mgt.", 'OnBeforeGetDocumentOnBeforeCheckStatusAndNextProcessStep', '', false, false)] local procedure OnBeforeGetDoc( DocNo: Code[20]; var Status: Enum "DXP Document Status"; var NextStep: Enum "DXP Next Process Step"; JObject: JsonObject; var IsHandled: Boolean) begin Status := Status::"Custom Processing"; // optionally adjust NextStep end; } [Best Practice] Use IsHandled := true only when you fully replace the standard logic – otherwise it can lead to inconsistent status/JSON states. Adding a field in the validation (up to Squeeze BC App version 1.*) The following uses an example extension to show how, as a developer, you can add fields in the validation. Required integration events including example procedures: codeunit 50100 EventSubs { // //Any header field that you want to transfer to the resulting document, has to be added to the source JSON Object // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure SQZDocMgtOnBeforeAddLineToDocumentJObj(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin AddCustomHeaderFieldsToJson(DocumentJObj, DocHeader); end; // // Any line field that you want to transfer to the resulting document, has to be added to the source JSON Object // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeAddLineJObjToLineJArray', '', false, false)] local procedure SQZDocMgtOnBeforeAddLineJObjToLineJArray(var LineJObj: JsonObject; DocLine: Record "DXP SQZ Document Line") begin AddCustomLineFieldsToJson(LineJObj, DocLine); end; // // [If you want to perform plausibility checks on the newly added header field, this is the place] // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnAfterDoHeaderPlausibilityChecks', '', false, false)] local procedure SQZDocMgtOnBeforeDoHeaderPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") begin CheckCustomer(PlausibilityCheck, DocHeader."Customer No."); end; // // [If you want to perform plausibility checks on the newly added line field, this is the place] // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnAfterDoLinePlausibilityChecks', '', false, false)] local procedure SQZDocMgtOnAfterDoLinePlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; DocLine: Record "DXP SQZ Document Line"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") begin CheckCustomer(PlausibilityCheck, DocLine."Customer No."); end; // // The value of the previously extended JSON Object now has to saved to the corresponding field in the SQUEEZE Document Line // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeModifySQUEEZEDocumentHeader', '', false, false)] local procedure SqzDocMgtOnBeforeModifySQUEEZEDocumentHeader(var DocHeader: Record "DXP SQZ Document Header"; RawJson: JsonObject) var JSONHelper: Codeunit "DXP Json Helper"; SQZApiTokenMgt: Codeunit "DXP SQZ API Token Mgt."; TokenMgt: Codeunit TokenMgt; begin DocHeader."Customer No." := COPYSTR(JsonHelper.ValAsTxt(RawJson, SQZApiTokenMgt.GetHeaderValueByNameTok(TokenMgt.GetCustomerNoTok()), false), 1, MaxStrLen(DocHeader."Customer No.")); end; // // The value of the previously extended JSON Object now has to saved to the corresponding field in the SQUEEZE Document Header // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues', '', false, false)] local procedure SQZDocMgtOnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues(RowJTok: JsonToken; var DocLine: Record "DXP SQZ Document Line") var JSONHelper: Codeunit "DXP Json Helper"; SQZApiTokenMgt: Codeunit "DXP SQZ API Token Mgt."; TokenMgt: Codeunit TokenMgt; begin DocLine."Customer No." := CopyStr(JsonHelper.ValAsTxt(RowJTok.AsObject(), SQZApiTokenMgt.GetCellValueTok(TokenMgt.GetCustomerNoTok()), false), 1, MaxStrLen(DocLine."Customer No.")); end; // // The newly added fields now have to be added to the field mapping // Otherwise the recognized values will be saved as meta data // This step is necessary to make sure that the fields can be highlighted in the SQUEEZE Viewer // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterInitMapping', '', false, false)] local procedure SQZApiMgtOnAfterInitMapping(var HeaderMapping: Dictionary of [Text, Integer]; var LineMapping: Dictionary of [Text, Integer]; DocClass: Enum "DXP Document Class") var SQZDocHeader: Record "DXP SQZ Document Header"; SQZDocLine: Record "DXP SQZ Document Line"; TokenMgt: Codeunit TokenMgt; begin // The standard (without installed extensions) supports one Document Class case DocClass of DocClass::"DXP Invoice / Credit Memo": begin HeaderMapping.Add(TokenMgt.GetCustomerNoTok(), SQZDocHeader.FieldNo("Customer No.")); LineMapping.Add(TokenMgt.GetCustomerNoTok(), SQZDocLine.FieldNo("Customer No.")); end; end; end; // // The value in the JSON Object now has to be transferred to the Purchase Header // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Transfer Mgt.", 'OnAfterCreatePurchaseHeader', '', false, false)] local procedure DocTransferMgtOnAfterCreatePurchaseHeader(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") begin TransferCustomHeaderFieldFromJsonToPurchaseHeader(JObject, PurchaseHeader); end; // // The value in the JSON Object now has to be transferred to the Purchase Line // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Transfer Mgt.", 'OnBeforeInsertPurchaseLine', '', false, false)] local procedure DocTransferMgtOnAfterInsertPurchaseLineOnBeforeAddDimensions(var JObjectLine: JsonObject; var PurchaseLine: Record "Purchase Line") begin TransferCustomHeaderFieldFromJsonToPurchaseLine(JObjectLine, PurchaseLine); end; local procedure TransferCustomHeaderFieldFromJsonToPurchaseHeader(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") var JsonHelper: Codeunit "DXP Json Helper"; TokenMgt: Codeunit TokenMgt; begin PurchaseHeader.Validate("DXP Customer No.", JsonHelper.ValAsTxt(JObject, TokenMgt.GetCustomerNoTok(), false)); PurchaseHeader.Modify(); end; local procedure TransferCustomHeaderFieldFromJsonToPurchaseLine(var JObjectLine: JsonObject; var PurchaseLine: Record "Purchase Line") var JsonHelper: Codeunit "DXP Json Helper"; TokenMgt: Codeunit TokenMgt; begin PurchaseLine.Validate("DXP Customer No.", JsonHelper.ValAsTxt(JObjectLine, TokenMgt.GetCustomerNoTok(), false)); end; local procedure AddCustomHeaderFieldsToJson(var DocumentJObj: JsonObject; SQZDocumentHeader: Record "DXP SQZ Document Header") var TokenMgt: Codeunit TokenMgt; begin DocumentJObj.Add(TokenMgt.GetCustomerNoTok(), SQZDocumentHeader."Customer No."); end; local procedure AddCustomLineFieldsToJson(var LineJObj: JsonObject; SQZDocumentLine: Record "DXP SQZ Document Line") var TokenMgt: Codeunit TokenMgt; begin LineJObj.Add(TokenMgt.GetCustomerNoTok(), SQZDocumentLine."Customer No."); end; [TryFunction] local procedure CustomerExists(CustomerNo: Code[20]) var Customer: Record Customer; begin Customer.Get(CustomerNo); end; local procedure CheckCustomer(var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt."; CustomerNo: Code[20]): Boolean begin if CustomerNo = '' then exit(false); if not CustomerExists(CustomerNo) then begin PlausibilityCheck.AddPlausibilityCheckEntry(GetLastErrorText(), Page::"Customer List"); exit(false); end; exit(true); end; } Table Extensions: SQUEEZE 4 BC tableextension 50100 "SQZ Doc. Header Ext." extends "DXP SQZ Document Header" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } tableextension 50101 "SQZ Doc. Line Ext." extends "DXP SQZ Document Line" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } Target document (here: purchase document) tableextension 50102 "Purchase Header Ext." extends "Purchase Header" { fields { field(50100; "DXP Customer No."; Code[20]) { DataClassification = CustomerContent; TableRelation = Customer; Caption = 'DEXPRO Customer No.'; } } } Page Extensions: SQUEEZE 4 BC pageextension 50100 "SQZ Document Ext." extends "DXP SQZ Document" { layout { addafter(BuyFromVendorInternal) { field("Customer No. Internal"; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; trigger OnAssistEdit() begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } addafter(BuyFromVendor) { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; trigger OnAssistEdit() var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } } local procedure MarkField(AppFldNo: Integer; FieldVal: Variant; DocHeader: Record "DXP SQZ Document Header") var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin ViewerResident := GetViewerResident(); ApiMgt.MarkField(AppFldNo, FieldVal, ViewerResident, DocHeader); end; } pageextension 50101 "SQZ Document Sf. Ext." extends "DXP SQZ Document Subform" { layout { addafter("No.") { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; } } } } Target document (here: purchase document) pageextension 50102 "Purchase Invoice Ext." extends "Purchase Invoice" { layout { addafter("Buy-from Vendor No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } } pageextension 50103 "Purchase Inv. Sf Ext." extends "Purch. Invoice Subform" { layout { addafter("No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } } Optional helper objects: codeunit 50101 TokenMgt { procedure GetCustomerNoTok(): Text begin exit(CustomerNoTok); end; var CustomerNoTok: Label 'customerNo', Locked = true; } Adding a field in the validation (from version 2.0) The following uses an example extension to show how, as a developer, you can add fields in the validation (here: document class Invoice/Credit Memo). Required integration events including example procedures: codeunit 50100 EventSubs { // //Any header field that you want to transfer to the resulting document, has to be added to the source JSON Object // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnBeforeAddLineToDocumentJObj', '', false, false)] local procedure SQZPInvCrdtMemoImplOnBeforeAddLineToDocumentJObj(var DocumentJObj: JsonObject; DocHeader: Record "DXP SQZ Document Header") begin AddCustomHeaderFieldsToJson(DocumentJObj, DocHeader); end; // // Any line field that you want to transfer to the resulting document, has to be added to the source JSON Object // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnBeforeAddLineJObjToLineJArray', '', false, false)] local procedure SQZPInvCrdtMemoImplOnBeforeAddLineJObjToLineJArray(var LineJObj: JsonObject; DocLine: Record "DXP SQZ Document Line") begin AddCustomLineFieldsToJson(LineJObj, DocLine); end; // // [If you want to perform plausibility checks on the newly added header field, this is the place] // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoHeaderPlausibilityChecks', '', false, false)] local procedure SQZPInvCrdtMemoImplOnBeforeDoHeaderPlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") begin CheckCustomer(PlausibilityCheck, DocHeader."Customer No."); end; // // [If you want to perform plausibility checks on the newly added line field, this is the place] // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoLinePlausibilityChecks', '', false, false)] local procedure SQZPInvCrdtMemoImplOnAfterDoLinePlausibilityChecks(DocHeader: Record "DXP SQZ Document Header"; DocLine: Record "DXP SQZ Document Line"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") begin CheckCustomer(PlausibilityCheck, DocLine."Customer No."); end; // // The value of the previously extended JSON Object now has to saved to the corresponding field in the SQUEEZE Document Line // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeModifySQUEEZEDocumentHeader', '', false, false)] local procedure SqzDocMgtOnBeforeModifySQUEEZEDocumentHeader(var DocHeader: Record "DXP SQZ Document Header"; RawJson: JsonObject) var JSONHelper: Codeunit "DXP Json Helper"; SQZApiTokenMgt: Codeunit "DXP SQZ API Token Mgt."; TokenMgt: Codeunit TokenMgt; begin DocHeader."Customer No." := COPYSTR(JsonHelper.ValAsTxt(RawJson, SQZApiTokenMgt.GetHeaderValueByNameTok(TokenMgt.GetCustomerNoTok()), false), 1, MaxStrLen(DocHeader."Customer No.")); end; // // The value of the previously extended JSON Object now has to saved to the corresponding field in the SQUEEZE Document Header // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues', '', false, false)] local procedure SQZDocMgtOnBeforeTransferRecognizedValuesOnAfterAssignRecognizedValues(RowJTok: JsonToken; var DocLine: Record "DXP SQZ Document Line") var JSONHelper: Codeunit "DXP Json Helper"; SQZApiTokenMgt: Codeunit "DXP SQZ API Token Mgt."; TokenMgt: Codeunit TokenMgt; begin DocLine."Customer No." := CopyStr(JsonHelper.ValAsTxt(RowJTok.AsObject(), SQZApiTokenMgt.GetCellValueTok(TokenMgt.GetCustomerNoTok()), false), 1, MaxStrLen(DocLine."Customer No.")); end; // // The newly added fields now have to be added to the field mapping // Otherwise the recognized values will be saved as meta data // This step is also necessary to make sure that the fields can be highlighted in the SQUEEZE Viewer // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnAfterInitMapping', '', false, false)] local procedure SQZApiMgtOnAfterInitMapping(var HeaderMapping: Dictionary of [Text, Integer]; var LineMapping: Dictionary of [Text, Integer]; DocClass: Enum "DXP Document Class") var SQZDocHeader: Record "DXP SQZ Document Header"; SQZDocLine: Record "DXP SQZ Document Line"; TokenMgt: Codeunit TokenMgt; begin case DocClass of DocClass::"DXP Invoice / Credit Memo": begin HeaderMapping.Add(TokenMgt.GetCustomerNoTok(), SQZDocHeader.FieldNo("Customer No.")); LineMapping.Add(TokenMgt.GetCustomerNoTok(), SQZDocLine.FieldNo("Customer No.")); end; end; end; // // The value in the JSON Object now has to be transferred to the Purchase Header // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Transfer Mgt.", 'OnAfterCreatePurchaseHeader', '', false, false)] local procedure DocTransferMgtOnAfterCreatePurchaseHeader(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") begin TransferCustomHeaderFieldFromJsonToPurchaseHeader(JObject, PurchaseHeader); end; // // The value in the JSON Object now has to be transferred to the Purchase Line // [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP Document Transfer Mgt.", 'OnBeforeInsertPurchaseLine', '', false, false)] local procedure DocTransferMgtOnAfterInsertPurchaseLineOnBeforeAddDimensions(var JObjectLine: JsonObject; var PurchaseLine: Record "Purchase Line") begin TransferCustomHeaderFieldFromJsonToPurchaseLine(JObjectLine, PurchaseLine); end; local procedure TransferCustomHeaderFieldFromJsonToPurchaseHeader(var JObject: JsonObject; PurchaseHeader: Record "Purchase Header") var JsonHelper: Codeunit "DXP Json Helper"; TokenMgt: Codeunit TokenMgt; begin PurchaseHeader.Validate("DXP Customer No.", JsonHelper.ValAsTxt(JObject, TokenMgt.GetCustomerNoTok(), false)); PurchaseHeader.Modify(); end; local procedure TransferCustomHeaderFieldFromJsonToPurchaseLine(var JObjectLine: JsonObject; var PurchaseLine: Record "Purchase Line") var JsonHelper: Codeunit "DXP Json Helper"; TokenMgt: Codeunit TokenMgt; begin PurchaseLine.Validate("DXP Customer No.", JsonHelper.ValAsTxt(JObjectLine, TokenMgt.GetCustomerNoTok(), false)); end; local procedure AddCustomHeaderFieldsToJson(var DocumentJObj: JsonObject; SQZDocumentHeader: Record "DXP SQZ Document Header") var TokenMgt: Codeunit TokenMgt; begin DocumentJObj.Add(TokenMgt.GetCustomerNoTok(), SQZDocumentHeader."Customer No."); end; local procedure AddCustomLineFieldsToJson(var LineJObj: JsonObject; SQZDocumentLine: Record "DXP SQZ Document Line") var TokenMgt: Codeunit TokenMgt; begin LineJObj.Add(TokenMgt.GetCustomerNoTok(), SQZDocumentLine."Customer No."); end; [TryFunction] local procedure CustomerExists(CustomerNo: Code[20]) var Customer: Record Customer; begin Customer.Get(CustomerNo); end; local procedure CheckCustomer(var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt."; CustomerNo: Code[20]): Boolean begin if CustomerNo = '' then exit(false); if not CustomerExists(CustomerNo) then begin PlausibilityCheck.AddPlausibilityCheckEntry(GetLastErrorText(), Page::"Customer List"); exit(false); end; exit(true); end; } Table Extensions: SQUEEZE 4 BC tableextension 50100 "SQZ Doc. Header Ext." extends "DXP SQZ Document Header" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } tableextension 50101 "SQZ Doc. Line Ext." extends "DXP SQZ Document Line" { fields { field(50100; "Customer No."; Code[20]) { TableRelation = Customer; ValidateTableRelation = false; Caption = 'Customer No.'; } } } Target document (here: purchase document) tableextension 50102 "Purchase Header Ext." extends "Purchase Header" { fields { field(50100; "DXP Customer No."; Code[20]) { DataClassification = CustomerContent; TableRelation = Customer; Caption = 'DEXPRO Customer No.'; } } } Page Extensions: SQUEEZE 4 BC pageextension 50100 "SQZ Document Ext." extends "DXP SQZ Document v2" { layout { addafter(BuyFromVendorInternal) { field("Customer No. Internal"; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; trigger OnAssistEdit() begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } addafter(BuyFromVendorExternal) { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; trigger OnAssistEdit() var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin MarkField(Rec.FieldNo("Customer No."), Rec."Customer No.", Rec); end; trigger OnValidate() begin CheckPlausibility(); end; } } } local procedure MarkField(AppFldNo: Integer; FieldVal: Variant; DocHeader: Record "DXP SQZ Document Header") var ApiMgt: Codeunit "DXP SQZ API Mgt."; ViewerResident: Codeunit "DXP SQUEEZE Viewer Resident"; begin ViewerResident := GetViewerResident(); ApiMgt.MarkField(AppFldNo, FieldVal, ViewerResident, DocHeader); end; } pageextension 50101 "SQZ Document Sf. Ext." extends "DXP SQZ Document Subform" { layout { addafter("No.") { field("Customer No."; Rec."Customer No.") { ApplicationArea = All; ToolTip = 'Specifies the value of the Customer No. field.'; } } } } Target document (here: purchase document) pageextension 50102 "Purchase Invoice Ext." extends "Purchase Invoice" { layout { addafter("Buy-from Vendor No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } } pageextension 50103 "Purchase Inv. Sf Ext." extends "Purch. Invoice Subform" { layout { addafter("No.") { field("DXP Customer No."; Rec."DXP Customer No.") { ToolTip = 'Specifies the value of the DEXPRO Customer No. field.'; ApplicationArea = all; } } } } Optional helper objects: codeunit 50101 TokenMgt { procedure GetCustomerNoTok(): Text begin exit(CustomerNoTok); end; var CustomerNoTok: Label 'customerNo', Locked = true; } Events when validating a SQUEEZE document (Validate action) Target audience This documentation is aimed at third-party developers who want to run their own logic when a user triggers the Validate action on the DXP SQZ Document v2 page (page  70954659) – for example additional custom checks before validation, setting further values on the SQUEEZE document, or follow-up actions on the target document that was created. The events described here are available from SQUEEZE for Dynamics 365 BC version 2.50. Context: what happens when you choose Validate? The Validate action calls two routines of the document page in sequence: 1)  CheckPlausibility() Runs the plausibility check of the respective document class and updates the plausibility entries in the lower part of the page. This routine runs not only when you choose Validate, but after almost every field change. It is therefore not a suitable hook for "once, on validation". To extend the check itself, use the already documented events  OnBeforeDoPlausibilityChecks,  OnAfterDoHeaderPlausibilityChecks,  OnAfterDoLinePlausibilityChecks and  OnAfterDoPlausibilityChecks. 2)  FinishValidation() Stops with an error message as long as plausibility entries are still open, handles the duplicate check where applicable, and then calls the  ValidateSQUEEZEDocument method of the  DXP SQZ Document Mgt. codeunit ( 70954632). That is where the processed JSON is created, the Core document ( DXP Document) is processed further, the target document is created and the SQUEEZE document is completed. Both events described here are raised in  DXP SQZ Document Mgt.ValidateSQUEEZEDocument. They therefore apply uniformly to: the Validate action on DXP SQZ Document v2 ( 70954659), the Validate action on DXP SQZ Document (Generic) ( 70954670) and the older document pages, the automatic validation (for example from the processing queue). There is deliberately no event directly on the action. If you want to distinguish between a manual click and automatic validation, evaluate the  AutomaticValidation parameter. Event matrix (overview) Area Event Timing Control Typical use cases DXP SQZ Document Mgt. OnBeforeAutomaticValidation Automatic validation only, before the posting date is defaulted and before the plausibility check that decides whether it goes ahead var IsHandled: Boolean skips the automatic validation; var DocHeader allows changes to the document Excluding documents from automatic validation, filling in values so that a document becomes plausible DXP SQZ Document Mgt. OnBeforeValidateSQUEEZEDocument After the plausibility and duplicate checks, before the processed JSON is created and the target document is generated var IsHandled: Boolean cancels the validation;  var DocHeader allows changes to the document Custom additional checks with cancellation, filling fields, starting an approval workflow, querying external systems DXP SQZ Document Mgt. OnAfterValidateSQUEEZEDocument After the Core document has been processed and the target document has been created, before the validation dialog Cancellation not possible Post-processing the target document, writing custom log tables, sending notifications, informing third-party systems Distinction from  OnAfterWriteProcessedJsonToBlob For logic that runs after validation, a Core event already exists. It is described on the page Creating custom documents (custom processing): [IntegrationEvent(false, false)] local procedure OnAfterWriteProcessedJsonToBlob(var Document: Record "DXP Document"; var ProcessedJSONObj: JsonObject) It is raised in the  DXP Document Mgt. codeunit (Core) after the processed JSON has been written to the Core document – within the validation process, so it fires when Validate is chosen as well.   OnAfterWriteProcessedJsonToBlob (Core) OnAfterValidateSQUEEZEDocument (SQUEEZE) Raised in DXP Document Mgt. DXP SQZ Document Mgt. Applies to all Core documents – including those from other DEXPRO source apps. You have to filter by document class yourself. SQUEEZE documents only Context DXP Document and the processed JSON additionally the complete  DXP SQZ Document Header with all recognised values, order matching and splitting information Manual vs. automatic cannot be distinguished can be distinguished via  AutomaticValidation Timing directly after the JSON is written, still inside the Core processing at the end of the validation, after the SQUEEZE document has been completed JSON modifiable yes ( var ProcessedJSONObj) no Recommendation: You want to modify the processed JSON or hand a document over to custom processing →  OnAfterWriteProcessedJsonToBlob. You want to evaluate SQUEEZE-specific values or react to manual validation only →  OnAfterValidateSQUEEZEDocument. You want to intervene before the target document is created, or to cancel the validation →  OnBeforeValidateSQUEEZEDocument. There is no Core equivalent for this. OnBeforeAutomaticValidation [IntegrationEvent(false, false)] local procedure OnBeforeAutomaticValidation(var DocHeader: Record "DXP SQZ Document Header"; var IsHandled: Boolean) This event is raised before a SQUEEZE document is validated automatically – before the posting date is defaulted and before the plausibility check that decides whether the automatic validation goes ahead at all. It is not raised when a user chooses Validate. Parameter Description var DocHeader The SQUEEZE document to be validated. Changes are used by the plausibility check and transferred to the target document, but they are not stored when the validation does not go ahead. Call Modify in the subscriber to keep them. var IsHandled Set to true, the automatic validation is skipped. The SQUEEZE document stays open and can be validated by a user. An entry with the result Skipped appears in the Creation Log. How it differs from OnBeforeValidateSQUEEZEDocument: this event is raised for every document that automatic validation is switched on for – including one that will not pass the plausibility check. OnBeforeValidateSQUEEZEDocument is only reached once the document is plausible. If you want to decide whether a document may be validated automatically, this is the place; if you want to set something just before the handover to the target document, the other one is. [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeAutomaticValidation', '', false, false)] local procedure OnBeforeAutomaticValidationSkipLargeAmounts(var DocHeader: Record "DXP SQZ Document Header"; var IsHandled: Boolean) begin // Documents of 10,000 and above are always to be looked at by a user. if DocHeader."Total Amount" >= 10000 then IsHandled := true; end; OnBeforeValidateSQUEEZEDocument [IntegrationEvent(false, false)] local procedure OnBeforeValidateSQUEEZEDocument(var DocHeader: Record "DXP SQZ Document Header"; AutomaticValidation: Boolean; var IsHandled: Boolean) Parameter Description var DocHeader The SQUEEZE document to be validated. Changes to fields are written afterwards and flow into the target document. AutomaticValidation false when Validate is chosen,  true for automatic validation. var IsHandled Set to  true to cancel the validation. The SQUEEZE document stays open, unchanged. The event is raised after: the document has been re-read and has neither the Deleted nor the Rejected status, the plausibility check succeeded, in the case of automatic validation, and before the processed JSON is created. At this point the target document does not exist yet. OnAfterValidateSQUEEZEDocument [IntegrationEvent(false, false)] local procedure OnAfterValidateSQUEEZEDocument(DocHeader: Record "DXP SQZ Document Header"; CoreDocument: Record "DXP Document"; AutomaticValidation: Boolean) Parameter Description DocHeader The validated SQUEEZE document. At this point its status is already Deleted – this is the regular final state of a validated document and not an error. CoreDocument The corresponding Core document ( DXP Document), including  Status and  Linked-to Record Id of the target document that was created. AutomaticValidation false when Validate is chosen,  true for automatic validation. Use the Core document to determine whether the target document was actually created: CoreDocument.Status = CoreDocument.Status::Transferred – the target document was created and  CoreDocument."Linked-to Record Id" points to it. CoreDocument.Status = CoreDocument.Status::"Custom Processing" – the document was handed over to custom processing; no standard target document exists. Important: custom checks do not belong in this event OnBeforeValidateSQUEEZEDocument is the wrong place for checks that are meant to prevent a validation. An  Error raised here only appears as a dialog after the user chose Validate – so the user learns about the problem at the very end of their work. Use one of the two approaches below instead. Both make the problem appear as a plausibility entry and disable the Validate action. Approach 1 (no development): plausibility rule group In the document class setup, define rules under Plausibility Rule Group. Every active and currently valid rule whose conditions match describes a problem and automatically creates a plausibility entry. Rules that reference the document lines are evaluated per line, so the entry points to the line concerned. For checks such as "Shortcut Dimension 1 Code must not be empty" this is the preferred approach – no code, no extension, maintainable by the user. Approach 2 (with development):  OnAfterDoPlausibilityChecks This event is published by all document classes with  var TempPlausibilityCheckEntry and is therefore the reliable route. You insert your entry into the temporary record directly: codeunit 50100 "My SQZ Plausibility Checks" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoPlausibilityChecks', '', false, false)] local procedure OnAfterChecks(DocHeader: Record "DXP SQZ Document Header"; var TempPlausibilityCheckEntry: Record "DXP Plausibility Check Entry" temporary) var CostCenterMissingLbl: Label 'Please enter a cost center.'; begin if DocHeader."Shortcut Dimension 1 Code" <> '' then exit; AddEntry(TempPlausibilityCheckEntry, CostCenterMissingLbl, DocHeader.RecordId(), 0); end; local procedure AddEntry(var TempPlausibilityCheckEntry: Record "DXP Plausibility Check Entry" temporary; MessageText: Text; LinkedToRecId: RecordId; LookupPageId: Integer) var NewEntryNo: Integer; begin NewEntryNo := 1; TempPlausibilityCheckEntry.Reset(); TempPlausibilityCheckEntry.SetCurrentKey("Entry No."); if TempPlausibilityCheckEntry.FindLast() then NewEntryNo := TempPlausibilityCheckEntry."Entry No." + 1; TempPlausibilityCheckEntry.Init(); TempPlausibilityCheckEntry."Entry No." := NewEntryNo; TempPlausibilityCheckEntry.Text := CopyStr(MessageText, 1, MaxStrLen(TempPlausibilityCheckEntry.Text)); TempPlausibilityCheckEntry."Linked to Record Id" := LinkedToRecId; TempPlausibilityCheckEntry."Lookup Page Id" := LookupPageId; if TempPlausibilityCheckEntry.Insert() then; end; } The publisher object depends on the document class: Document class Codeunit Purchase invoice / credit memo DXP SQZ P. Inv/Crdt Memo Impl. Order confirmation DXP SQZ P. Order Conf. Impl. Generic document classes DXP SQZ Document Mgt. Set  Linked to Record Id and  Lookup Page Id (for lines:  Page::"DXP SQZ Document Subform") so that the plausibility entry becomes clickable and jumps to the record concerned. Alternative:  OnAfterDoHeaderPlausibilityChecks PlausibilityCheck.AddPlausibilityCheckEntry(...) offers a more convenient API that saves you the manual insert into the temporary record: [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ P. Inv/Crdt Memo Impl.", 'OnAfterDoHeaderPlausibilityChecks', '', false, false)] local procedure OnAfterHeaderChecks(DocHeader: Record "DXP SQZ Document Header"; var PlausibilityCheck: Codeunit "DXP Plausiblity Check Mgt.") var CostCenterMissingLbl: Label 'Please enter a cost center.'; begin if DocHeader."Shortcut Dimension 1 Code" = '' then PlausibilityCheck.AddPlausibilityCheckEntry(CostCenterMissingLbl, 0); end; OnAfterDoLinePlausibilityChecks works the same way for line checks; the  AddPlausibilityCheckEntry(Text; LinkedToRecId; LookupPageId) overload makes the entry clickable. Caution for the order confirmation document class: in  DXP SQZ P. Order Conf. Impl., the events  OnBeforeDoHeaderPlausibilityChecks,  OnBeforeDoLinePlausibilityChecks,  OnAfterDoHeaderPlausibilityChecks and  OnAfterDoLinePlausibilityChecks were originally published without  var on the  PlausibilityCheck parameter. A subscriber receives a copy there, so entries it adds are lost. For this document class, use the variants with the  V2 suffix from version 2.50 onwards – for example  OnAfterDoHeaderPlausibilityChecksV2. Their signature is identical to the events of the other document classes. The old events remain available but are marked as obsolete. Example 1: adding values before the handover to the target document [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnBeforeValidateSQUEEZEDocument', '', false, false)] local procedure OnBeforeValidateSetPostingDescription(var DocHeader: Record "DXP SQZ Document Header"; AutomaticValidation: Boolean; var IsHandled: Boolean) begin if DocHeader."Posting Description" = '' then DocHeader."Posting Description" := CopyStr(DocHeader."Document Reference", 1, MaxStrLen(DocHeader."Posting Description")); // No Modify required – the document is written afterwards. end; Modifying the target document: please use the Core events If you want to change the target document that was created, neither event on this page is the right place. Core provides events that hand you the target document directly – most of them even as a typed  Purchase Header, so you can skip the detour via  Linked-to Record Id and a  RecordRef. These events are described on the page Events after the creation of a Core document (DXP Document): Target document Codeunit Event Purchase invoice / credit memo DXP P. Inv. CredMemo. Creation OnAfterProcessStandardDocument(JObject; DocRecRef) Purchase document, general DXP Document Transfer Mgt. OnAfterCreatePurchaseDoc(var JObject; PurchaseHeader) Purchase header DXP Document Transfer Mgt. OnAfterCreatePurchaseHeader(var JObject; PurchaseHeader) Purchase order DXP P. Order Creation OnAfterCreatePurchaseOrder(var JObject; var PurchaseHeader) Order confirmation DXP P. Order Confirmation OnAfterProcessStandardDocument(JObject; var PurchaseHeader) OnAfterValidateSQUEEZEDocument is only the better choice if you additionally need values from the  DXP SQZ Document Header – for example recognised values, order matching or splitting information that is not contained in the JSON of the Core document. Example 2: reacting to manual validation only [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ Document Mgt.", 'OnAfterValidateSQUEEZEDocument', '', false, false)] local procedure OnAfterValidateNotifyUser(DocHeader: Record "DXP SQZ Document Header"; CoreDocument: Record "DXP Document"; AutomaticValidation: Boolean) var ValidatedMsg: Label 'Document %1 has been forwarded.', Comment = '%1 = SQUEEZE document no.'; begin if AutomaticValidation then exit; if not GuiAllowed() then exit; Message(ValidatedMsg, DocHeader."No."); end; Notes and limitations No dialogs in automatic processing. Always check  AutomaticValidation and  GuiAllowed() before  Message,  Confirm or  Page.RunModal. Otherwise the processing queue runs into an error. OnBeforeValidateSQUEEZEDocument runs after the plausibility check. Custom checks that are supposed to appear in the page's plausibility entries and to disable the Validate action belong in  OnAfterDoHeaderPlausibilityChecks or  OnAfterDoLinePlausibilityChecks instead. IsHandled := true cancels completely. No target document is created, the Core document stays unchanged and the SQUEEZE document keeps its status. The user does not get a message – issue one yourself if required. No event for deleted or rejected documents. If the document has the Deleted or Rejected status, validation ends beforehand and neither event is raised. OnAfterValidateSQUEEZEDocument runs after a  Commit. An  Error in a subscriber does not roll the validation back; it leaves a validated document plus an error message for the user. Related pages Creating custom documents (custom processing) Events after the creation of a SQUEEZE document (CreateSource) Events after the creation of a Core document (DXP Document) Rule-based next process step (routing documents into custom processing) Events before retrieving and creating SQUEEZE documents Audience This documentation is for third-party developers who want to control whether Business Central retrieves documents from SQUEEZE – typically to prevent a test system from retrieving them. It focuses on the two integration events in codeunit DXP SQZ API Mgt. that are raised before documents are retrieved. Both events are available from SQUEEZE version 2.54.0.0. Background: why a test system should not retrieve documents If a test system is connected to the same SQUEEZE instance as the production system – for example because it was created as a copy of production – it retrieves documents from there as well. When a document is created, it is set to FINISHED in SQUEEZE. A document retrieved by a test system is no longer available to the production system. If the test system should not communicate with SQUEEZE at all, no extension is needed, see Test system retrieves documents from Squeeze. The events are meant for cases where the test system should detect and prevent the retrieval by itself, or where only certain documents should be held back. Context: how documents are retrieved Retrieval runs in two steps, both in codeunit DXP SQZ API Mgt.: DownloadDocumentData fetches the ids of the documents waiting for export in SQUEEZE and adds them to the import queue. It also fetches documents with status Resynchronize again. CreateCoreAndSQUEEZEDocument fetches the document for each open import queue entry, creates the Core document ( DXP Document) and the SQUEEZE document, marks the entry as processed and sets the document to FINISHED in SQUEEZE. Both steps run in the job queue and with the Download Documents now action on the Squeeze Documents, Squeeze Import Queue Entries and Squeeze Queue pages. Each step is preceded by an event with IsHandled. Event matrix (overview) Event When Control Typical use cases OnBeforeDownloadDocumentData before the document ids are fetched from SQUEEZE IsHandled prevent all retrieval in a test system; switch a test system to a SQUEEZE test instance OnBeforeCreateCoreAndSQUEEZEDocumentV2 before a single document is fetched and created IsHandled do not create documents that are already queued; hold back certain document classes or documents Events in DXP SQZ API Mgt. OnBeforeDownloadDocumentData Raised at the very start of DownloadDocumentData, before any connection to SQUEEZE is made. Signature: [IntegrationEvent(false, false)] local procedure OnBeforeDownloadDocumentData(var IsHandled: Boolean) With IsHandled := true the whole step is skipped: no document ids are fetched, no import queue entries are written and no documents with status Resynchronize are fetched again. The Squeeze Setup is only read after this event. A subscriber can therefore also switch the connection to a SQUEEZE test instance here instead of preventing retrieval – see the section Connecting a test system to a SQUEEZE test instance below.   OnBeforeCreateCoreAndSQUEEZEDocumentV2 Raised in CreateCoreAndSQUEEZEDocument for each document, before it is fetched from SQUEEZE. Signature: [IntegrationEvent(false, false)] local procedure OnBeforeCreateCoreAndSQUEEZEDocumentV2(DocClass: Enum "DXP Document Class"; SQUEEZEDocId: Text[50]; var IsHandled: Boolean) Parameters: DocClass – document class of the document, e.g. DXP Invoice / Credit Memo or DXP Order Confirmation SQUEEZEDocId – id of the document in SQUEEZE IsHandled – set to true to skip the document With IsHandled := true: neither a Core document nor a SQUEEZE document is created, the document in SQUEEZE stays unchanged – it is not set to FINISHED, the import queue entry stays unprocessed and is offered again on the next run. To shield a test system completely, you need this event in addition to OnBeforeDownloadDocumentData: a copy of the production system also brings along the entries that were already in its import queue. Without this event they would be created in the test system. Skipped entries are retried on every run and count towards the up to 10 entries a run processes. If you hold back only some documents, these entries can delay the processing of the others. The older event OnBeforeCreateCoreAndSQUEEZEDocument is obsolete and no longer raised. Use OnBeforeCreateCoreAndSQUEEZEDocumentV2 instead. Minimal example: prevent retrieval in a sandbox The example treats every sandbox as a test system. Adapt object ids/names to your namespace and the check in IsTestSystem to your rules. codeunit 50102 "My SQZ Test System Guard" { [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnBeforeDownloadDocumentData', '', false, false)] local procedure SkipDownloadInTestSystem(var IsHandled: Boolean) begin if IsTestSystem() then IsHandled := true; end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnBeforeCreateCoreAndSQUEEZEDocumentV2', '', false, false)] local procedure SkipCreationInTestSystem(DocClass: Enum "DXP Document Class"; SQUEEZEDocId: Text[50]; var IsHandled: Boolean) begin if IsTestSystem() then IsHandled := true; end; local procedure IsTestSystem(): Boolean var EnvironmentInformation: Codeunit "Environment Information"; begin // Example: every sandbox counts as a test system. // On-premises or for other rules, use a check of your own, // e.g. the database name from the "Active Session" table. // A flag in a table of your own does not work when the // test system is created as a copy of production. exit(EnvironmentInformation.IsSandbox()); end; } With the Download Documents now action the user gets no feedback that retrieval was skipped. If you want that, show a message in the subscriber – only when GuiAllowed() is true, so the job queue is not affected. Connecting a test system to a SQUEEZE test instance Instead of preventing retrieval, a test system can also work with a SQUEEZE test instance of its own. This pays off especially when the test system is rebuilt regularly from a backup of production – for example every sprint – and should then run against the test instance without manual work. You do not need a dedicated event or a parameter for the connection. SQUEEZE reads the Squeeze Setup from the database, and during retrieval only after OnBeforeDownloadDocumentData. Once you switch the setup to the test instance permanently, all subsequent calls go there: retrieving and creating documents, reporting FINISHED, attachments, viewer, training and master data synchronization. Switching the connection Assign the URL field of the setup directly – without Validate and without a trailing slash. Validate on this field opens the SQUEEZE login as a dialog. The job queue and Invoke-NAVCodeunit have no dialog, so the call fails there with an error. Then call GetAPIData(SqzSetup, ApiKey, false) from DXP SQZ API Mgt. with the API key of the test instance. This is the same path as the login on the setup page, only without the dialog: the key is checked against the test instance and stored, the version and tenant of the test instance are taken over, the master data tables are determined again and the setup is saved. Do not put the API key of the test instance into the source code. Store it, for example, in the isolated storage of your own extension. If you store it in the production system, it is available in the test system after every copy. What else you need to switch Document classes: The Squeeze Document Class ID and Squeeze Export Interface ID fields in the Document Classes Setup belong to a specific SQUEEZE instance. If they differ in the test instance, switch them in the same step. Open import queue entries: The copy brings along the entries that were not yet processed in production. Processing does not filter by tenant, so these documents are looked up in the test instance. If the test instance does not know them, every attempt fails, is repeated on every run and takes up slots of the up to 10 entries per run. Delete them after switching with DeleteUnprocessedImportQueueEntries from DXP SQUEEZE Setup Mgt., passing the previous tenant. Note it from the Tenant field of the setup before you switch. In a session with a user interface, the function asks for confirmation before deleting. When to switch Right after the rebuild (recommended): On-premises, call your codeunit with Invoke-NAVCodeunit for each company in the script that restores the backup – before the job queue starts. Restoring a backup does not put job queue entries on hold. Without this step the SQUEEZE tasks, e.g. retrieval and master data synchronization, start right away with the production connection. In addition, in OnBeforeDownloadDocumentData as a safeguard: The same switch in the event, with IsHandled left at false. The current retrieval then already runs against the test instance. The event only applies to retrieval, though. Anything that runs before it, e.g. master data synchronization, still uses the production connection. Recognizing the test system Do not recognize the test system by a flag in a table. Tables are overwritten with every copy of production, so the test system then holds the production value again. On-premises, use the database or server instance name from the Active Session table; in Business Central online, IsSandbox() or GetEnvironmentName() from codeunit Environment Information. Example The example switches an on-premises test system that is recognized by its database name. Adapt object ids, names, the check in IsTestSystem and where URL and API key come from to your environment. codeunit 50103 "My SQZ Test Connection" { // On-premises: run for each company after restoring the backup, e.g. // Invoke-NAVCodeunit -ServerInstance BC -CompanyName 'CRONUS International Ltd.' -CodeunitId 50103 trigger OnRun() begin ApplyTestConnection(); end; [EventSubscriber(ObjectType::Codeunit, Codeunit::"DXP SQZ API Mgt.", 'OnBeforeDownloadDocumentData', '', false, false)] local procedure SwitchToTestConnection(var IsHandled: Boolean) begin // Safeguard in case the call after the restore was missed. // IsHandled stays false: retrieval then runs against the test instance. ApplyTestConnection(); end; local procedure ApplyTestConnection() var SqzSetup: Record "DXP SQUEEZE Setup"; SqzApiMgt: Codeunit "DXP SQZ API Mgt."; SqzSetupMgt: Codeunit "DXP SQUEEZE Setup Mgt."; PreviousTenant: Text[250]; begin if not IsTestSystem() then exit; if not SqzSetup.Get() then exit; if SqzSetup.URL = GetTestUrl() then exit; PreviousTenant := SqzSetup.Tenant; SqzSetup.URL := GetTestUrl(); // no Validate: it opens the login dialog SqzApiMgt.GetAPIData(SqzSetup, GetTestApiKey(), false); // Remove open import queue entries that came from production SqzSetupMgt.DeleteUnprocessedImportQueueEntries(PreviousTenant); // If the document class id or export interface id differs in the // test instance, adjust "DXP Document Class Setup" here as well. end; local procedure IsTestSystem(): Boolean var ActiveSession: Record "Active Session"; begin // Do not use a table of your own: it is copied along. ActiveSession.Get(ServiceInstanceId(), SessionId()); exit(ActiveSession."Database Name" = 'BC_TEST'); end; local procedure GetTestUrl(): Text[1024] begin // URL of the test instance without a trailing slash, // e.g. from a setup of your own end; local procedure GetTestApiKey(): Text begin // API key of the test instance, e.g. from the isolated storage // of your own extension - not in the source code end; } In the event, the safeguard only costs reading the session and the setup on every retrieval: once the URL has been switched, ApplyTestConnection exits right away. FAQ Here you will find questions and answers to various scenarios. Master data cannot be synchronized Checking the squeeze masterdata tables in BC In the setup for the Squeeze master data tables, you can see which master data tables are to be synchronized or have already been synchronized. You can also deactivate synchronization with Squeeze for individual tables there. Checking the order synchronization Orders are not transferred immediately but every 5 minutes by the job queue entry "DEXPRO SQUEEZE - Master Data Synchronisation". A released order can therefore take up to 5 minutes to appear in Squeeze. Check in the job queue entries whether this entry exists and has the status "Ready". If it is missing, create it with the Create Jobs action in the SQUEEZE Setup. Checking the Squeeze Master Data On the Squeeze page, you can check whether all master data tables already exist. If any are missing, a 404 error may occur during the synchronization attempt. This is avoided in the latest app version by subsequently creating the table in Squeeze in case of doubt. Checking the setup Squeeze Setup Does the Squeeze URL match? Is the correct squeeze system stored? Check the URL for this. What is the connection status? Is the tick green? If not, get a current API key. Has the initial master data upload already taken place? Document class Setup Are the API settings of the document class correct? Please check whether the IDs entered match those on the DEXPRO platform. Checking the Documentclass Id   Checking the Export Interface id   Checking the Line Table id   Documents are not retrieved from Squeeze and remain there in the export step Checking the import queue Is there already an entry in the import queue with the Squeeze docId? Please also remove the system filtering when checking. Click on “Show system filter” to display the system filters. As soon as these filters have been removed, all documents are displayed across all clients. Check whether the Squeeze docid exists in the “Document Id” column and whether the entry has already been processed. If so, it cannot be downloaded again. The document must then be manually set to the “Processed” step on the Squeeze page (DEXPRO platform). If the document is not in the list, the uncollected document can be pulled directly via the import buffer. Checking the setup Squeeze Setup Does the Squeeze URL match? Is the correct squeeze system stored? Check the URL for this. What is the connection status? Is the tick green? If not, get a current API key. Document class Setup Are the API settings of the document class correct? Please check whether the IDs entered match those on the DEXPRO platform. Checking the Documentclass Id   Checking the Export Interface id   Checking the Line Table id   Test system retrieves documents from Squeeze A test system that is connected to the same SQUEEZE instance as the production system – for example because it was created as a copy of production – retrieves documents from there as well. A retrieved document is marked as processed in SQUEEZE. Documents retrieved by the test system are then missing in the production system. Deactivate SQUEEZE in the test system If the test system should not communicate with SQUEEZE at all, deactivate SQUEEZE there: In the test system, open the Squeeze Setup page. Clear the Activated field. The Active field of the DEXPRO SQUEEZE app in the DEXPRO Apps part of the Core Setup page does the same. The two fields are kept in sync. The test system then no longer retrieves documents – neither through the job queue nor through the Download Documents now action. If the action is run anyway, it shows the message App DEXPRO SQUEEZE not activated. No function that calls SQUEEZE is available in the test system then. Because the setup is copied along with every new copy of production, SQUEEZE is activated again afterwards. Repeat the deactivation after every copy – or have it done automatically (see the next section). Automatically or only for certain documents If the test system should detect and prevent the retrieval by itself, or if only certain documents should be held back, a developer can implement this with two integration events, available from SQUEEZE version 2.54.0.0. Description and example: Events before retrieving and creating SQUEEZE documents. That page also describes how a developer connects the test system automatically to a SQUEEZE test instance of its own after every copy, instead of preventing retrieval. Selecting account assignments based on conditions Account assignments can be linked to conditions, so that SQUEEZE picks the right account assignment setup for a document automatically. Setup Open the Document Class Setup of the document class. In the Rules section at the bottom, create a new value in the Account Assignment Code field. {add screenshot of Document Class Setup, Rules section, here} This value is a rule group. From now on, account assignments can be set by rules: in this rule group you create and define individual rules, for example one per vendor. {add screenshot of the rules of the account assignment rule group here} Example A rule for an insurance company as vendor: {add screenshot of Rule here} The upper part of the rule defines the if. Your conditions can refer to any field of the SQUEEZE document header and to any information linked to it, compared with the various operators. Conditions can be combined with AND or OR. Example: if the vendor no. equals 4711 AND the Description field of a document line contains "Examination fee", the then is applied. It is defined in the lower DEXPRO Squeeze part of the rule, where you select the matching account assignment setup in the Account Assignment Code field. The account assignment setup The account assignment setup itself defines which VAT rates are taken into account and how they are assigned. This lets you handle the VAT rates of each vendor specifically, so that invoices with several VAT rates are later assigned automatically in one go. An example for a VAT rate of 19%: {add screenshot of Squeeze Account Assignment Setup Line here} At the top is the VAT Rate to be assigned. In the middle is the account assignment itself. At the bottom are the shortcut dimensions, such as cost centre or cost object, which are also set by the automatic account assignment. Which account assignment setup is used: if a rule of the rule group applies and has an account assignment code, that code is used. Otherwise SQUEEZE takes the account assignment code from the Vendor Related Setup of the vendor and, failing that, the one in the document class setup. This way, a requirement like the one in the example can be met in the standard app without any programming. Assigning accounts to individual lines by rule The account assignment code above chooses one account assignment setup for the whole document. Line account assignment rules work on each document line on its own: a rule gives every line that matches it an account and dimensions. For example, all lines whose description contains "Freight" can go to a freight G/L account with the cost centre of the logistics department. Setup Open the Document Class Setup of the document class. In the Rules section, create a new value in the Line Account Assignment field. Like the account assignment code, this value is a rule group. Create the rules of this rule group. Their conditions can refer to the document line as well as to the SQUEEZE document header and the other linked information. Conditions on the document line are checked against each line on its own, which is why the rule card does not show the Record Match Type for these rules. Define the then in the lower DEXPRO Squeeze part of the rule, group Line Account Assignment: Account Type and Account No. — the G/L account, item, resource, fixed asset or item charge the line gets. Leave Account No. empty to only add dimensions. Gen. Prod. Posting Group and VAT Prod. Posting Group — replace the posting groups the line takes from the account, for example to match the VAT rate of the document. Leave them empty to keep those of the account. Dimensions — the shortcut dimensions the line gets. The Line Dimensions action on the rule edits all dimensions of the rule, including those without a shortcut. {add screenshot of Rule with the Line Account Assignment group here} How the rules are applied The rules run automatically when an invoice, credit memo or order confirmation is imported from SQUEEZE. They run after the other automatic steps of the import, such as autocomplete, the order match and the account assignment by VAT rate, so they see the final lines. They run before an automatic validation, so the assigned accounts are transferred to the target document. For each line, the rules are checked in the order of their Sequence No. Only active rules that are currently valid count. The first rule whose conditions match is applied, and no further rule is checked for that line. A line that no rule matches stays as it is. A matching rule without an account and without dimensions leaves the line unchanged and keeps the rules after it away from that line. Use such a rule to exclude lines. A matching rule overrides the account a line already has, including one set by the account assignment setup. Quantity, direct unit cost, discounts and line amount stay exactly as read from the document. Lines allocated to an order or receipt line are skipped: their account comes from that line. The dimensions of the rule are added to those the line already has, for example the default dimensions of the account. If both have a value for the same dimension, the rule wins. The Item Match Method field of the line shows which rule assigned the account, for example Assigned by account assignment rule FREIGHT (Freight costs). The field is hidden by default; add it to the lines by personalising the page. An account that has been blocked since the rule was set up does not stop the import. The plausibility check of the document reports it. Applying the rules again After you have changed a rule or corrected the lines, choose Functions → Apply Account Assignment Rules on the lines of the SQUEEZE document. A message shows how many lines a rule was applied to, for example The account assignment rules were applied to 3 of 5 lines. If the document class has no rule group in the Line Account Assignment field, the action stops with Line Account Assignment is not set up for document class … followed by the document class. Squeeze API - specification of new endpoints for master data tables Background and motivation Squeeze is used via the Business Central (BC) integration to maintain master data per company in Squeeze tables. A single Squeeze system can serve several hundred BC companies, where each company has its own record in a master data table – typically identified by a column such as companyName or companyId. Current problem The existing batch endpoints under /masterData/tables/{tableId}/rows/batch do not sufficiently cover the use case: Endpoint Behavior Problem PUT /rows/batch Deletes all existing rows and replaces them completely Not usable, because the data of all companies would be deleted. To update only one company, the data of all other companies would have to be sent as well. POST /rows/batch Adds new rows but does not update existing ones Creates duplicates on repeated calls instead of updating existing records. PUT /rows/{rowId} Updates a single row For thousands of records per company this is far too slow and generates thousands of individual API requests. DELETE /rows/{rowId} Deletes a single row Also one request per row – unsuitable for bulk operations. Required solution Three new batch endpoints are needed: Batch upsert ( PATCH /masterData/tables/{tableId}/rows/batch) – insert or update records without deleting rows that are not affected. Batch delete by ID ( POST /masterData/tables/{tableId}/rows/batch/delete) – delete multiple rows by an ID list in a single request. Batch delete by filter ( POST /masterData/tables/{tableId}/rows/batch/delete/filter) – delete multiple rows by column filters in a single request. Endpoint 1: Batch upsert Overview PATCH /masterData/tables/{tableId}/rows/batch Goal: Insert or update multiple rows in a table in a single request (upsert), without affecting other rows. Semantics: For each submitted row the following applies: If a row with the given identifier already exists → update the existing row. If no row with the given identifier exists yet → insert as a new row. All other rows in the table that are not included in the request remain unchanged. HTTP method PATCH – because the request represents a partial change to the table content (not a complete replacement as with PUT). URL parameters Parameter In Type Required Description tableId path integer yes ID of the master data table Query parameters Parameter Type Required Default Description useExternalId boolean no false Analogous to the existing single-row endpoints. If true, the externalId of each row is used as the key for the upsert match. If false (default), the internal row ID (auto-increment) is used as the key. skipErrors boolean no false If true, faulty rows are skipped and the remaining rows are processed. If false, the entire batch is rolled back transactionally on an error (see the "Behavior on errors" section). Note on the key modes: useExternalId=false (default): Each row must contain the internal id (integer, auto-increment). The API checks by this ID whether the row exists. This mode is suitable when the internal Squeeze IDs are known. useExternalId=true: Each row must contain the externalId field (string). The API checks by this value whether a row exists. In the context of Business Central, the externalId is typically composed of a combination of SystemId, table name, and company name, making it globally unique across all companies. If the respective key field ( id or externalId) is missing in a row, that row is treated as an error. Request body Content-Type: application/json A JSON array of objects. Each object represents a row as a key-value map (column name → value). Depending on the useExternalId parameter, each row must contain either the id field (internal) or externalId. Example with useExternalId=true (BC use case): [ { "externalId": "CRONUS|Item|27f3a1c2-...", "companyCode": "CRONUS", "articleNo": "1000", "description": "Bicycle", "price": "599.00" }, { "externalId": "CRONUS|Item|91b8d4f7-...", "companyCode": "CRONUS", "articleNo": "1001", "description": "Helmet", "price": "49.90" } ] Example with useExternalId=false (default, internal ID): [ { "id": 101, "articleNo": "1000", "description": "Bicycle", "price": "599.00" }, { "articleNo": "9999", "description": "New article", "price": "12.50" } ] Rows without an id field are inserted as new records in the default mode ( useExternalId=false). Rows with a known id are updated. Response HTTP 200 – Success Response format identical to MasterDataUploadResponse (already used for PUT /rows/batch and POST /rows/batch): { "error": false, "totalLines": 2, "errorLineAmount": 0, "skipErrors": false, "dataType": "json", "errorLines": [] } Field Type Description error boolean true if at least one error occurred totalLines integer Total number of processed rows errorLineAmount integer Number of faulty rows skipErrors boolean Indicates whether errors were skipped dataType string Data format of the input ( "json") errorLines string[] List of faulty rows (as a string representation) Recommendation: It would be helpful if the response additionally distinguished between insertedLines and updatedLines, so that the caller receives feedback about the upsert effect: { "error": false, "totalLines": 50, "insertedLines": 5, "updatedLines": 45, "errorLineAmount": 0, "skipErrors": false, "dataType": "json", "errorLines": [] } HTTP 400 – Bad request When a row is missing the required key field (with useExternalId=false the id, with useExternalId=true the externalId): { "message": "Row at index 2 is missing the required key field 'externalId'.", "statusCode": 400 } HTTP 404 – Table not found { "message": "Master data table with id 42 does not exist.", "statusCode": 404 } Behavior on errors If skipErrors=false (default): The entire batch is processed transactionally. If an error occurs on a row, all changes already made in the batch are rolled back. The response contains a detailed error message with the index of the faulty row and the reason for the error: { "error": true, "message": "Batch aborted: row at index 3 failed – column 'price' contains invalid value 'abc'. All changes have been rolled back.", "statusCode": 422 } If skipErrors=true: Faulty rows are skipped and documented in errorLines. Correct rows are committed. No rollback takes place. Example call (BC use case with externalId) PATCH /api/v2/masterData/tables/42/rows/batch?useExternalId=true&skipErrors=false Content-Type: application/json Authorization: Bearer [ { "externalId": "CRONUS|Item|27f3a1c2-...", "companyCode": "CRONUS", "articleNo": "1000", "description": "Bicycle", "price": "599.00" }, { "externalId": "CRONUS|Item|91b8d4f7-...", "companyCode": "CRONUS", "articleNo": "9999", "description": "New article", "price": "12.50" } ] Expected result: The row with externalId = "CRONUS|Item|27f3a1c2-..." already exists → description and price are updated. The row with externalId = "CRONUS|Item|91b8d4f7-..." does not exist yet → a new row is inserted. All other rows in the table remain unchanged. Endpoint 2: Batch delete by ID list Overview POST /masterData/tables/{tableId}/rows/batch/delete Goal: Delete multiple rows of a table by a list of internal IDs or external IDs in a single request. URL parameters Parameter In Type Required Description tableId path integer yes ID of the master data table Query parameters Parameter Type Required Default Description useExternalId boolean no false If true, the IDs given in the body are interpreted as external IDs (analogous to the existing single-row endpoints). Request body Content-Type: application/json { "rowIds": ["abc-123", "def-456", "ghi-789"] } Field Type Required Description rowIds string[] yes List of the row IDs to delete. With useExternalId=false, internal IDs (integer as string); with useExternalId=true, external IDs (for example "CRONUS|Item|27f3a1c2-..."). Response HTTP 200 – Success { "deletedRows": 3 } Field Type Description deletedRows integer Number of rows actually deleted HTTP 400 – Bad request When rowIds is missing or is an empty array: { "message": "Request body must contain a non-empty 'rowIds' array.", "statusCode": 400 } HTTP 404 – Table not found { "message": "Master data table with id 42 does not exist.", "statusCode": 404 } Example call: delete by internal ID POST /api/v2/masterData/tables/42/rows/batch/delete Content-Type: application/json Authorization: Bearer { "rowIds": ["101", "102", "103"] } Example call: delete by externalId (BC use case) POST /api/v2/masterData/tables/42/rows/batch/delete?useExternalId=true Content-Type: application/json Authorization: Bearer { "rowIds": ["CRONUS|Item|27f3a1c2-...", "CRONUS|Item|91b8d4f7-..."] } Expected result: The specified rows are deleted. All other rows remain untouched. Endpoint 3: Batch delete by filter Overview POST /masterData/tables/{tableId}/rows/batch/delete/filter Goal: Delete all rows of a table that match one or more column filters – in a single request. URL parameters Parameter In Type Required Description tableId path integer yes ID of the master data table Request body Content-Type: application/json Filter structure analogous to the existing endpoint POST /masterData/tables/{tableId}/rows/search: { "filters": [ { "columnName": "companyCode", "operand": "=", "searchValue": "CRONUS" } ], "isAndConnectedQuery": true } Field Type Required Description filters MasterDataColumnFilter[] yes List of column filters. Must contain at least one filter. isAndConnectedQuery boolean no false = filters are connected with OR, true = filters are connected with AND. Default: false. MasterDataColumnFilter schema (already present in the API): { "columnId": 5, "columnName": "companyCode", "operand": "=", "searchValue": "CRONUS", "lookupFieldFilter": false } Field Type Description operand string Comparison operator (for example =, !=, LIKE, >, <) columnId integer ID of the column (alternative to columnName) columnName string Name of the column (alternative to columnId) searchValue string Search value lookupFieldFilter boolean Controls the SQL join logic (see existing documentation) Response HTTP 200 – Success { "deletedRows": 127 } Field Type Description deletedRows integer Number of rows actually deleted HTTP 400 – Bad request When filters is missing, is an empty array, or the body is empty: { "message": "Request body must contain a non-empty 'filters' array.", "statusCode": 400 } Security note: An empty filters array [] is rejected with HTTP 400. An empty filter must under no circumstances lead to all rows of the table being deleted. HTTP 404 – Table not found { "message": "Master data table with id 42 does not exist.", "statusCode": 404 } Example call POST /api/v2/masterData/tables/42/rows/batch/delete/filter Content-Type: application/json Authorization: Bearer { "filters": [ { "columnName": "companyCode", "operand": "=", "searchValue": "CRONUS" } ], "isAndConnectedQuery": true } Expected result: All rows of table 42 where companyCode = "CRONUS" are deleted. Rows of other companies remain untouched. Summary of the new endpoints Endpoint Method Function /masterData/tables/{tableId}/rows/batch PATCH Upsert: insert or update rows without deleting other rows /masterData/tables/{tableId}/rows/batch/delete POST Batch deletion by a list of internal IDs or external IDs /masterData/tables/{tableId}/rows/batch/delete/filter POST Batch deletion by column filters Data types used (reference to existing schemas) Schema Already present Usage MasterDataUploadResponse yes Response for PATCH upsert MasterDataColumnFilter yes Filter in the request body of endpoint 3 KeyValueCollection yes Single row as key-value pairs (internal)