Skip to Content

Query in Approval Process not working

My query does not seem to be working in Approval Procedure. It returns a 'True' when run in SQL with the actual CardCode of the Sales Order, but in B1, the Sales Order gets saved without the Approval procedure being triggered. The query I am using is given below.

SELECT Distinct 'True'  FROM ORDR T0 WHERE
$[ORDR.CardCode] IN (SELECT T1.CardCode FROM OCRD T1 WHERE (select T1.CreditLine - T1.Balance)  < 0 AND T1.CardType  = 'C' AND T1.GroupNum NOT IN (25, 28, 29, 30, 31) AND T1.CardName NOT LIKE 'One-Time%' AND T1.PymCode <> 'CreditCard' AND T1.QryGroup2='Y'
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 11, 2017 at 05:12 PM

    A close bracket at the end was missed. Please read the query as

    SELECT Distinct 'True'  FROM ORDR T0 WHERE
    $[ORDR.CardCode] IN (SELECT T1.CardCode FROM OCRD T1 WHERE (select T1.CreditLine - T1.Balance)  < 0 AND T1.CardType  = 'C' AND T1.GroupNum NOT IN (25, 28, 29, 30, 31) AND T1.CardName NOT LIKE 'One-Time%' AND T1.PymCode <> 'CreditCard' AND T1.QryGroup2='Y')
    Add comment
    10|10000 characters needed characters exceeded