Approval Query needed for AR Reserve Invoice
Need to create an approval for delivery doc- If AR reserve invoice not paid need to triger an approval. how can I cutomise the query to look at base document.
SELECT DISTINCT 'TRUE' FROM OINV T0 WHERE T0.[isIns] = 'Y' AND T0.[DocStatus] <> 'C'
Thanks and Regards
Jesper Magnusson replied
This one should do it I believe. I have attachde the query as not everything gets copied in this forum. The query below will not work.
SELECT distinct 'true' FROM DLN1 T0 WHERE T0.[BaseType] = 13 and $[$38.45.1] in (SELECT docentry FROM OINV T0 WHERE isins = 'Y' and paidtodate <> doctotal)
There are a few limitations with approvals in B1 that are based on values on the linelevel like this one.
The query can not see past the first line of the document. So it will only check the basedoc of the first item in the Delivery (it is possible to add an item on the first line after copying the Reserve Invoice details into the delivery).
Apart from that, the query only checks if the payment have been fully done "(paidtodate <> doctotal)", if it has been partially paid it will still trigger the approval. If partial payment is acceptable you can change that to "paidtodate <> 0".
Hope it helps,