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?
- 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.