How to check if the LineItems are found

Question

How to check if the LineItems are found or not?

Answer

You can check it using Script Rule on the Invoice Document Definition level:

if (Context.Field("LineItems").Items.Count == 0)    
    {Context.CheckSucceeded = false;
    Context.ErrorMessage = "NO LINEITEMS FOUND";
  }

Since the Script Rule needs a trigger to be executed, it should contain an existing field. So, if the LineItems were not found, the script will not run.

In order to make it work as expected, any existing field should be added to the rule (PONumber field in the example below):

​​

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed