Rene,
Here are two code snippets to delete the last page of the document. The first one is RA and the second one is LFSO.
RA (Workflow 9.1)
'Make sure we wrap the code in a Try Catch to catch errors...
Try
'Get a reference to starting entry...
Dim docInfo As DocumentInfo = Me.BoundEntryInfo
'Lock the document...
docInfo.Lock(LockType.Exclusive)
'Delete the page and persist the changes...
'NOTE: The docInfo.PageCount parameter targets the last page
'of the document...
docInfo.DeletePage(docInfo.PageCount)
docInfo.Save()
'Unlock the target document...
docInfo.Unlock()
'Cleanup...
docInfo.Dispose()
Catch ex As Exception
'Report any errors to workflow...
WorkflowApi.TrackError(ex.message)
End Try
LFSO (Workflow < 9.1)
Try
'Get a reference to the starting entry and its pages...
Dim lfDoc As LFDocument = Me.Entry
Dim lfDocPages As LFDocumentPages = lfDoc.Pages
'Lock the document....
lfDoc.LockObject(Lock_Type.LOCK_TYPE_WRITE)
'Mark the last page of the document...
lfDocPages.MarkPageByIndex(lfDocPages.Count)
'Delete the marked page...
lfDocPages.DeleteMarkedPages()
'Persist the changes and unlock document...
lfDocPages.Update()
lfDoc.UnlockObject()
'Cleanup...
lfDoc.Dispose()
Catch ex As Exception
WorkflowApi.TrackError(ex.Message)
End Try
Let me know if this helps...