What are the possible steps to export the Batch ID?
To export the Batch ID please follow this instruction:
1. Create the Text Field "BatchID" in your Document Definition.
2. In the Rules tab of "BatchID" properties create a new Script Rule. The settings of the new rule should look like this:
Make sure that the created rule is Enabled and the Read-Only option for the "BatchID" field is turned off (it is on by default).
3. Add the following Script to the rule:
this.Field("BatchID").Value = this.Document.Batch.Id;
This way the "BatchID" will be populated with the Batch ID value automatically.