Symptom
An approval procedure is not triggered when you update an existing Sales Order.
Environment
SAP Business One
Reproducing the Issue
Prerequisites:
In the Approval Template Setup window, you have selected the option Active When Updating Documents Not Generated by Approval Process.
Scenario:
1. Create the following query:
SELECT 'true' WHERE (SELECT count(*) FROM ORDR T0 WHERE T0.[DocNum] = $[ORDR.DocNum]) > 0
or when using SAP HANA, use the following query:
SELECT 'true' from DUMMY WHERE (SELECT count(*) FROM ORDR T0 WHERE T0."DocNum" = $[ORDR."DocNum"]) > 0
2. Define an Approval Stage, with the authorizer as, e.g user A001.
3. Define an Approval Template:
-
- On the Document tab, select Sales Order.
- Select the Approval Stage from Step 2.
- Select the query on the Term tab.
4. Find an existing Sales Order which was not involved previously in the approval process. Edit one or more fields, e.g. Remarks.
Expected behavior:
The system triggers the Approval Process.
Actual behavior:
The Approval Process is not triggered and the Sales Order can be saved with the changes.
Resolution
As the user-defined query only has a docnum, and the docnum is not changed, the approval process is not triggered.
If you expect the system to trigger the approval process in update mode, you need to put the changed field used to trigger the approval process in the user-defined query.