I have a custom workflow activity that uses LFSO80 and PDFExporter80 that I am trying to convert to an SDK Script that will use RA and DocumentServices. I figured out how to do the connection wrapper, and I am able to export the file out as a .pdf but am having trouble figuring out how to retrieve and use field values to build out the file path and document names dynamically. Can anyone help me with how to do this? The original activity code is below:
Imports Laserfiche.Workflow.Activities
Imports Laserfiche.Workflow.ComponentModel
Imports LFSO80Lib
Imports System.IO
Imports PdfExporter80
Public Class Activity1
Inherits LaserficheActivity
Protected Overrides Function OnExecuteCode(ByVal context As Laserfiche.Workflow.ComponentModel.LaserficheExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus
Dim doc As LFDocument = context.Entry
Dim dpages As LFDocumentPages = doc.Pages
dpages.MarkAllPages()
Dim DocName As String
DocName = doc.Name
Dim FD As LFFieldData = doc.FieldData
' Gets the field value from the field data.
Dim FieldVal As String = FD.FieldAsString("Path")
Dim ExportFolder As String
ExportFolder = (FieldVal)
Dim PdfOptions As New ExportOptions
PdfOptions.SetLayers(DocumentLayers.All)
Dim PdfExp As New PdfExporter
PdfExp.SetOptions(PdfOptions)
Dim Arr() As Byte = PdfExp.ExportPages(doc)
Dim Pdf As New FileStream(ExportFolder & "\" & DocName & ".pdf", FileMode.Create)
Pdf.Write(Arr, 0, Arr.Length)
Return MyBase.OnExecuteCode(context)
End Function
End Class