Unique ID for a recognized document

  • Last Post 01 December 2017
tvidenov posted this 24 November 2017

Hi All,

I am looking for a way to access the document id after recognized. I need to write it in a database during the export of the data. Can anyone help?

Order By: Standard | Newest | Votes
Vladimir Dimitrijevic posted this 24 November 2017


Are you using custom script in a workflow stage, or export out of document definition?


Best regards,


tvidenov posted this 27 November 2017

Well, currently i am trying with a custom script/rule for a custom field and searching for such value. If there is such value at all I should be able to get it by a rule, at least I hope so...

Vladimir Dimitrijevic posted this 27 November 2017


Yes, there is. If you are using "Batch processing" type of script, then you would go with:

foreach (IDocument document in Documents) {

string documentId = document.Id;




Best regards,


Ekaterina posted this 27 November 2017

In fact, there are two different situations for the values that are written in the IDocument :: Id property.
If the documents are assembled by the layout, then IDocument :: Id is just the string representation of document's number in the batch (equals to IDocument :: Index)
If the documents are assembled by barcodes, then IDocument :: Id is the same as barcode value. In this case to get the unique number of a document a hidden property IDocument :: InternalId can be used.

tvidenov posted this 27 November 2017

Hi Ekaterina,

 I am using FC12 for invoices if that excludes somе of the proposed solutions. 

Can I access this internalID value from a rule in Document Definition to map it to a field?

Ekaterina posted this 01 December 2017


Due to changes made to object model of FC12, the InternalId will not work as document index in the batch, however it will be still a unique document identifier. 

You may use Service Field "Document Number" or Context.Document.Pages[0].Id.ToString() to get document's number in the batch.