Change the Batch Name¶
Legacy (Process Designer)
This page describes a script for the Modify Your Metadata activity of Process Designer. It was replaced by the Custom Step in Workflow. The script may not run as a Custom Step without changes. For new work, use the Custom Step reference.
KnowledgeLake has added properties to the Modify Your Metadata step to allow the custom naming of batches that can show up in the Monitor and in the Index App.
To change batch names, you will use the SetBatchName method.
For example, if I wanted to name my documents something like Miles and Miles - Inv 2250 where "Miles and Miles" is the value of a field called Vendor and "2250" was an Invoice Number on the first document in my batch, the below example would be used in Modify Your Metadata to accomplish this.SetDocumentMetadata method in the same manner as our other examples to set DocumentName for any doc using metadata or additional Javascript.
For example. if I wanted the same naming convention as above in the batch section, but for each document to have its own Vendor and Invoice Number, I would use:
Full Script¶
var vendor = batch.Documents[0].Metadata["Index"]["Vendor"];
var invNum = batch.Documents[0].Metadata["Index"]["Invoice Number"];
builder.SetBatchName(vendor + " - Inv " + invNum);
Walkthrough¶
var Vendorandvar invNumare grabbing the values of my Vendor and Invoice Number column.
var vendor = batch.Documents[0].Metadata["Index"]["Vendor"];
var invNum = batch.Documents[0].Metadata["Index"]["Invoice Number"];
- This line is using
SetBatchNamein conjunction with the variables set above, and the static metadata " - Inv " to add text between the values when they are concatenated.