Community

IF Condition to Send a PDF to Manual Review when Classification Confidence is Below X Amount

The PDFs in my use case can have multiple classifications in it. Due to that, I'm using the assemble step and have the 'First Page' checkbox enabled for all classification types, so each page of the PDF can have a different classification. 

I'm trying to create a script to loop through each page, and if any of them have a classification below 85%, it sends the doc to manual review. Below is my script, however it does not appear to be working, what should I change to fix this?

 

 

var docPages = Context.Transaction.Documents
for (let i = 0; i <= docPages.length; i++) {
 var docConfidence = Context.Transaction.Documents[i].ClassConfidences[0].Confidence;
 if (docConfidence < 85 || docConfidence == null) {    
    return true;
    break;
}
else {
    return false;
}
}

Was this article helpful?

0 out of 0 found this helpful

Comments

1 comment

Please sign in to leave a comment.