NOTE: This will be done using the Modify Your Metadata activity in version 1.10 and later.
This activity will check our IndexUser field for a value. If it finds a value, it will mark a field called IsIndexed as 'true'. If it doesn't find a value, it will set that field to 'false'.
For instructions on deploying an activity, refer to our Deploying Custom Activities Article.
NOTE: Running the below powershell will add a custom activity into your process designer under the category Custom Activities.
Set IsIndexed Metadata Activity
Import-Module 'C:\Program Files\KnowledgeLake\Core\Modules\Capture.Core'
$role = Get-Role -Name 'Activity Processing'
# Set IsIndexed Metadata
############################################
# IsIndexed will be True if IndexUser exists in the document
if((Get-ActivityDefinition -Name "Set IsIndexed") -eq $null) {
Add-ActivityDefinition -Name 'Set IsIndexed' -Category "Custom Activities" -ActivityType Action -ActivityScope Default -Version 1 -Active 1 -RoleId $role.Id -ScriptBlock {
$Context.batch | Get-Document | ForEach-Object {
$doc=$_;
$IsIndexed = $doc.Metadata.Index.IndexUser
If ([string]::IsNullOrWhiteSpace($IsIndexed)){
Set-DocumentMetadata -Document $doc -ClassKey 'Index' -Key 'IsIndexed' -Value 'False'
}
Else{
Set-DocumentMetadata -Document $doc -ClassKey 'Index' -Key 'IsIndexed' -Value 'True'
}
}
}
}
Step by Step
- The first thing this script block will do is iterate through each document in a batch using a ForEach-Object
- On each document, it will check the IndexUser field for a value and set it to the variable $IsIndexed
- Then we will check $isIndexed for a value. If that value is null via ([string]::IsNullOrWhiteSpace($IsIndexed)), we will set the field IsIndexed to false.
- If the value isn't null, we will set IsIndexed to true.
Once this value is set, you can use it to route or see if a document has been indexed based on the presence of an IndexUser from the Scan, Upload, and Index Apps.
Comments
0 comments
Please sign in to leave a comment.