Clear a Value from a Field for All Documents in a Batch¶
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.
The Index App shows items as indexed based on a piece of metadata called CS5MarkAsIndexed. In a few circumstances, we've needed to reset these items to not show as indexed for specific workflows.
Below is an example of how we would remove a value from that field to reset this status using the Modify Your Metadata step.
Full Script¶
batch.Documents.forEach(function (doc) {
var RemoveIndexBool = doc.Metadata["General"]["CS5MarkAsIndexed"];
if (RemoveIndexBool === true) {
builder.SetDocumentMetadata(doc.DocumentId, "General", "CS5MarkAsIndexed", false);
}
})
Walkthrough¶
- First, we want to define
DocURLas a variable we label fieldToSet to be used later.
-
Then, we will use a
forEachto cycle through each document to perform our task on all documents. -
From there, you will set a new variable called DocUrlValue to the general metadata value of DocURL as mentioned in the description above.
This will only be present after an Upload to Destination has been performed.
- Finally, we will use
SetDocoumentMetadatato set the fieldToSet (DocURL) with our docUrlValue from step 3 in the Index section.