Description
KnowledgeLake deals with a lot of transactional content, and in turn, alot of transaction related activities such as approvals. Below is an example of a very simple approval automation to get you started.
NOTE: Modify your Metadata is only available in Capture Server Pro 1.10 and later.
Example
batch.Documents.forEach(function (doc) {
var balanceDueValue = parseFloat(doc.Metadata["Index"]["BalanceDue"]);
if (balanceDueValue <= 0) {
builder.SetDocumentMetadata(doc.DocumentId, "Index", "IsApproved", "true");
}
else {
builder.SetDocumentMetadata(doc.DocumentId, "Index", "IsApproved", "false");
}
});
For each document in a batch, we are going get the value for the BalanceDue field and convert it to a float data type. If the BalanceDue value is less than or equal to zero, the IsApproved field is set to true. Otherwise the IsApproved field is set to false.
1. |
batch.Documents.forEach(function (doc) { |
|
First, you will want to cycle through each document and get the value of the BalanceDue field and convert it to a float called balanceDueValue. |
2. |
if (balanceDueValue <= 0) { |
|
Second and thirdly, we will want to look at the value and determine if there is in fact a balance due. If there is a balance of 0, there is no balance and the IsApproved field will be set to true. |
3. |
else { |
|
If the value is not less than or equal to zero, the IsApproved field will be set to false. |
Comments
0 comments
Please sign in to leave a comment.