I have read some of the other posts on this topic already but none of them seem to work with version 9.1. I keep getting errors and I have tried both C# and vb.net scripts. What I need to do after workflow is finished is have the entries automatically copy over to a shared folder on the network so the next part of the process, which is in a different program, can pick up where LF leaves off. Can anyone help with the correct syntax for this - Cliff Primmer's code looks really good, but I get errors saying that the SDK doesn't know what LFDocument is, and others. I'm having trouble tweaking it correctly. Thanks for your help :)
Question
Question
Replies
Alright, yesterday, I had found some of Cliff Primmer's sample code on the old forums, but today that thread is no longer active. So, here is what I think was the code I saw - with very few minor changes
Inherits RAScriptClass91 '''<summary> '''This method is run when the activity is performed. '''</summary> Protected Overrides Sub Execute() Dim document as LFDocument = Me.BoundEntryInfo Dim pages as LFDocumentPages = document.Pages Dim exporter as New DocumentExporterClass Dim fullFileName as String = "<MYSERVERNAME>" & document.Name pages.MarkAllPages() exporter.Format = Document_Format.DOCUMENT_FORMAT_TIFF exporter.AddSourcePages(pages) exporter.ExportToFile(fullFileName) document.Dispose() exporter = Nothing pages = Nothing End Sub
However, when I run this at the end of my workflow, it tells me the following error now:
Unable to cast object of type 'Laserfiche.RepositoryAccess.DocumentInfo' to type 'LFSO91Lib.LFDocument'.
I am really needing this portion of this workflow done as quickly as possible as I am on a time crunch and have quite a bit of coding to do outside of Laserfiche for this project. Can anyone help me get this working please? I would really, really appreciate it!
Thanks
It sounds like you added a reference to LFSO91 to your script? You would have to log into the repository and get the entry by ID. Please make sure you know how you got LFSO91 on the machine as it is not one of the files installed by Workflow (so the script may break in future updates).
Me.BoundEntryInfo is only valid when using the default reference to RepositoryAccess.
Another way to do this would be to add a reference to LFSO90 (which is installed by Workflow) and change the script to say "Inherits SDKScriptClass90" instead of "Inherits RAScriptClass91". Then you can use Me.Entry to reference the entry.
Amy,
It looks like there is a mixture of older LFSO (Laserfiche Server Objects) and RA (Repository Access) code in this example. Maybe a result of pulling code snippets from some old LFSO examples and inserting them into a new 9.1 SDK Script Activity?
The error that the script is throwing is because the 'Me.BoundEntryInfo' object is of type RA DocumentInfo and the script is trying to cast it as an older LFSO LFDocument object (which it does not know how to do).
If I recall correctly the 9.1 SDK Script activity defaulted to RA not LFSO so I would stick with all RA objects if you can. The document export functions in RA are part of the DocumentServices namespace so you will need to add the appropriate references in the script activity to access that assembly and the object that you need to instantiate and use is the DocumentServices.DocumentExporter class.
You mention that you are under a time crunch to get this done; I do have a pre-built custom workflow activity that will allow you to export a document to a UNC share. It is available on the Products page at www.qfiche.com. All of the custom workflow activities available on the website are fully functional 30 day demos.
Cliff - Is there a way we could chat outside of this forum for a few minutes? If so, please email me at adowd@axh.com. I would appreciate it. Thanks :)