How to keep BatchID consistent?

Currently in our data model has a field called BatchID and the value was populated with script "Folder.Batch.ID" at Default Value Expression. However, When the batch was spawned to new process then the Batch got a new BatchID. At first we tried to use the batch name but the batch name can be duplicates.

Is there a way to keep track of the batch with unique identifier?



  • strotellistrotelli Posts: 40 mod
    Yes use a batch processing script to assign the value without the default value expression. 

    Here is an example of what it should look like 

      Private Sub BatchProcess_BatchCompleted(sender As Object, e As BatchProcess.BatchCompletedEventArgs) Handles BatchProcess.BatchCompleted
            Select Case e.StepCompleted.Name
                Case "Scan"
                        Dim CurBatch As Batch = e.Batch
                        Dim myFolder As BatchFolder = CurBatch.BatchRoot
                        Dim di As DocumentInstance = myFolder.IndexData
                        Dim fi As FieldInstance = di.Fields("Batch_ID")
                        e.Batch.Name = e.Batch.Name + " " + e.Batch.Id.ToString
                        fi.Value = "hello"

                    Catch ex As Exception

                        Grooper.WriteToEventLog(EventLogEntryType.Error, ex.Message, e.Batch)
                    End Try
  • DungVuDungVu Posts: 60
    Stotelli, Should I put script in an unattanded activity?
  • DungVuDungVu Posts: 60
    I put the script in the ProcessingScript but my index data is not updated with new value using fi.value = "Hello"
  • DungVuDungVu Posts: 60
    Can I run update the Index data field with the new value within the process script? Do I need to use the Data Instances? Please give me some direction how to build this. Thanks
Sign In or Register to comment.