How to make invoices stop at Verification if Line Items table has no rows?


I would like invoices that do not have any line items to throw an error and stop at the Verification stage. Currently, they are all skipping it if there are no uncertain characters or any other rule errors. How can I achieve that?


It is possible with the script rule that would check that the Line Items are not completely empty (0 rows). To do it:
  • Add a new script rule in Document Definition Properties > Rules > owned by Invoice > New Rule:
  • Add the LineItems field and some of the header fields (i.e. Invoice Number), so the rule could be triggered:

  • Below is a sample script:​
if (Context.Field("LineItems").Items.Count == 0)
    Context.CheckSucceeded = false;
    Context.ErrorMessage = "Line Items are empty.";

  • Save and publish the document definition.

After that, invoices with empty LineItems will throw the error and will stop at the Verification.

Have more questions? Submit a request


1 comment

  • Avatar

    Ranjit Nayak

    I have the same issue, I am following the same rule. But its still adding blank lineitems.

    We are tying to avoid blank line items for other vendor where its not applicable linked to same document definition.

    Any suggestion would be helpful.


Please sign in to leave a comment.