Forum Navigation
You need to log in to create posts and topics.

Approval Template Query - Trigger an Approval when Customer XXX Orders from Warehouse YY

In SAP Business One, you are familiar with Approval Templates. SAP Business One Approval Templates help companies practice fire prevention instead of fire fighting. Here is an example of a custom Approval Template query that requires approval when a customer orders anything from a specific warehouse. One thing to note is, only the first row of the Sales Order is being checked.

NOTE: The goal of any approval template query is to generate a "TRUE" for the trigger to generate an approval.

Replace C30000 with your problematic customer.

Replace 06 with your appropriate warehouse.

SELECT DISTINCT 'TRUE'
FROM DUMMY
WHERE
$[$38.24.0] = '06'
AND $[ORDR.CardCode] <> 'C30000'

1. Paste the above query in the the query generator and save as "Your Name Here"
2. Create an Approval Template using the "Terms Based on User Queries" portion of the approval template.

Now, when customer C30000 is sold inventory from warehouse 06, it will automatically save the Sales Order as a Draft document, requiring appropriate approval.