Workflow Instance Objects
Description
Get the index field value of the current workflow instance.
Syntax
RDWFInstance.DocProps(Index Field Name)
Example
' Retrieve the value of the document property "Invoice No." from the workflow instance Dim value As String = wfi.DocProps("Invoice No.")
Description
Get the table index field value of the current workflow instance.
Syntax
RDWFInstance.DetailProps(Index Field Name)
Example
' Access the property group named "Account detail" from the detailed properties of the workflow instance Dim dt As RDPropertyGroup = wfi.DetailProps("Account detail") ' Iterate through each property item in the specified property group For Each dp As RDPropertyItem In dt.GetLists(0, 0) ' Retrieve the value of the "Account Name" property from the current property item Dim value As String = dp.DocumentProperty("Account Name") Next
Description
Get all attachment list in the current workflow instance.
Syntax
RDWFInstance.GetRelations()
Example
' Retrieve the collection of related items from the workflow instance Dim list As RDCollection = wfi.GetRelations()
Description
Update the index field value of the current workflow instance.
Syntax
RDWFInstance.DocProps(field_name) = value
Example
' Set the value of the document property "Invoice No." in the workflow instance to "123" wfi.DocProps("Invoice No.") = "123" ' Save the changes made to the workflow instance after updating the document property wfi.Update()
Description
Update the table index field value of the current workflow instance.
Syntax
RDPropertyItem.DocumentProperty(Field name or Field id) = value
Example (add new row)
' Access the property group named "Account detail" from the retrieved document's detailed properties
Dim dt As RDPropertyGroup = wfi.DetailProps("Account detail")
' Create a new property item within the specified property group
Dim pi As RDPropertyItem = dt.CreateNew()
' Set the "Account Code" property of the new property item to "123"
pi.DocumentProperty("Account Code") = "123"
' Set the "Account Name" property of the new property item to "HSBC"
pi.DocumentProperty("Account Name") = "HSBC"
' Save the changes made to the new property item
pi.Update()
' Update the count of properties in the property group after adding a new item
dt.UpdateCount()
' Save the changes made to the workflow instance after updating its detailed properties
wfi.Update()
Example (update existing row)
' Access the property group named "Account detail" from the retrieved document's detailed properties Dim dt As RDPropertyGroup = wfi.DetailProps("Account detail") ' Iterate through each property item in the specified property group For Each dp As RDProperties In dt.GetLists(0, 0)
' Check if the "Account Code" property of the current item is equal to "123" If dp.DocumentProperty("Account Code") = "123" Then
' Update the "Account Code" property to "456" dp.DocumentProperty("Account Code") = "456" ' Save the changes made to the current property item dp.Update() End If Next ' Update the count of properties in the property group after modifications dt.UpdateCount() ' Save the changes made to the workflow instance after updating its detailed properties wfi.Update()
Description
Move all current workflow instance attachment files to folder.
Syntax
RDDocument.MoveTo(New Parent, ACL MoveOption: 0 = Align to Source, 1 = Align to Destination)
Example
' Iterate through each document related to the workflow instance For Each doc As RDDocument In wfi.GetRelations ' Create an instance of RDFolderController to manage folder operations Dim fc As RDFolderController = srv.CreateController(ControllerType.RDFolderController) ' Retrieve a specific folder by its unique identifier (ID) Dim folder As RDFolder = fc.GetFolderById(1) ' Move the current document to the specified folder, with ACL Move Option 0 or 1 doc.MoveTo(folder, 1) ' Save the changes made to the document after moving it doc.Update() Next
Description
Copy all current workflow instance attachment files to folder.
Syntax
RDDocument.CopyTo(New Parent)
Example
' Iterate through each document related to the workflow instance For Each doc As RDDocument In wfi.GetRelations ' Create an instance of RDFolderController to manage folder operations Dim fc As RDFolderController = srv.CreateController(ControllerType.RDFolderController) ' Retrieve a specific folder by its unique identifier (ID) Dim folder As RDFolder = fc.GetFolderById(1) ' Copy the retrieved document to the specified folder doc.CopyTo(folder, 1) ' Save the changes made to the document after moving it doc.Update() Next
Description
Convert the current workflow instance eForm to PDF and save to a folder.
Syntax
EForm.SaveAsPDF(Memory Stream)
Example
' Create an instance of RDFolderController to manage folder operations using the specified controller type Dim fc As RDFolderController = srv.CreateController(2) ' Retrieve a specific folder by its path Dim f As RDFolder = fc.GetFolderByPath("Home\Test") ' Get the collection of related documents from the workflow instance Dim dl As RDCollection = wfi.GetRelations ' Iterate through each document in the collection of related documents For i As Integer = 0 To dl.Count - 1 ' Retrieve the current document from the collection Dim doc As RDDocument = dl(i) ' Check if the document is eform If doc.DocExtension = ".rfti" Then ' Get the current version of the document Dim v As RDVersion = doc.GetVersion ' Retrieve the XML content of the eform's version Dim node As System.Xml.XmlNode = v.GetContentXml ' Create a new eForm instance using the XML content Dim ef As New DMS.EForm.EForm(node, "") ' Use a memory stream to save the eForm as a PDF Using ms As New IO.MemoryStream ef.SaveAsPDF(ms, "") ' Create an instance of RDDocumentController to manage document operations using the specified controller type Dim dc As RDDocumentController = srv.CreateController(3) ' Generate a filename for the new PDF document by replacing the extension Dim filename As String = doc.NameWithExtension.Replace(".rfti", ".pdf") ' Create a new PDF document in the specified folder Dim pdfForm As RDDocument = dc.CreateDocument(filename, f) ' Add the PDF content from the memory stream to the new document pdfForm.AddFileContent(New DMSStream(ms.ToArray), filename, "") ' Save the changes made to the new PDF document pdfForm.Update() ' Copy index information from the workflow instance to the new PDF document wfi.CopyIndexTo(pdfForm) End Using ' Exit the loop after processing the first eform found Exit For End If Next
There are no comments for now.