Description
If you have a value that might be populated by a cover sheet and apply to all documents in a batch, we have an example activity that will get you up and running.
NOTE: Modify your Metadata is only available in Capture Server Pro 1.10 and later.
Example
if (batch.Documents.length > 1) {
var originalDoc = batch.Documents[0];
var firstNameValue = originalDoc.Metadata["Index"]["FirstName"];
batch.Documents.forEach(function (doc) {
if (doc != originalDoc) {
builder.SetDocumentMetadata(doc.DocumentId, "Index", "FirstName", firstNameValue);
}
});
}
If a batch has more than one document, get the value of the FirstName field from the first document in the batch. Then, copy that value to the FirstName column of all subsequent documents in the batch.
1. |
if (batch.Documents.length > 1) { |
|
First, we will ensure the batch has more than one document. |
2. |
var originalDoc = batch.Documents[0]; |
|
From there, we will take document 1, or 0 in the array of documents, and set it to a variable of OriginalDoc. From there, we will grab the FirstName field from that document and set it to firstNameValue. |
3. |
batch.Documents.forEach(function (doc) { |
|
Then, we will cycle through each document that isn't originalDoc and set the FirstName field to firstNameValue in all documents within the batch. |
Comments
0 comments
Please sign in to leave a comment.