DocumentNo function

The DocumentNo function returns a long integer value indicating the sequence of the current document (record) being written to the destination. The value 1 indicates the first document that was written, 2 indicates the second document that was written, and so on.

Syntax
DocumentNo

Parameters
None

Return value
A long integer

Comments
You can use the DocumentNo function in the Before Document, Before Document Commit and After Document scripts.

Example
The following example is the After Document script for a vendor integration. It creates a text file that lists whether each document being imported created a new vendor or updated an existing vendor. The DocumentNo function indicates the order in which documents were added or updated. The DocumentID variable used was set in the Before Document script.

Const ForAppending = 8
Dim fso, f
Set fso = CreateObject(“Scripting.FileSystemObject”)
Set f = fso.OpenTextFile(“C:\Program Files\Microsoft Dynamics\Integration 
Manager\VendRslt.txt”,
ForAppending, True)
If DocumentIsNew = True Then
	f.WriteLine “Document “ & DocumentNo & “ “ &
	GetVariable(“DocumentID”) & “ is new.”
Else
	f.WriteLine “Document “ & DocumentNo & “  “ &
	GetVariable(“DocumentID”) & “ was updated.”
End If


Documentation Feedback