Hi All,
Does anyone know of a method for creating an error if there is not at least one instance of the repeating group 'PurchaseOrder' in Flexicapture for Invoices.
Tried loads of rule scripts, merge scripts etc but can't get anything to fire if the group is empty.
Thanks
Richard
Does anyone know of a method for creating an error if there is not at least one instance of the repeating group 'PurchaseOrder' in Flexicapture for Invoices.
Tried loads of rule scripts, merge scripts etc but can't get anything to fire if the group is empty.
Thanks
Richard
Comments
2 comments
Please try making a simple Document processing script containing this:
if (Context.Field("PurchaseOrder").Items.Count==0){
Context.CheckSucceeded=false;
Context.ErrorMessage="_something_";
}
Please let me know if you have any other questions or this solution doesn't work,
Vladislav
Thanks for your response. Had seen this technique in vbscript in the example scripts in manual, like you I'd changed to C# and also borrowed some of the code from the existing scripts in the invoice document definition. So I had:
I then put 'Rejected' in the rule 'Tags' so that an error message would be generated in the 'Invoice Status' section of the data form.
I applied this at the group level with only the group selected in 'Available Fields' and tested, didn't seem to work, then put the other fields from the group into the 'Available Fields' section and again didn't seem to work.
The I went for this from the sample scripts:
So took the group out of the 'Available Fields' and added the 'Order Number' field instead
Changed the code to
Didn't like that, couldn't find the field.
At last I found that
Works as expected if you put in a rule outside of the group, at the document level.
Thanks again.
Ricahard
Please sign in to leave a comment.