Hey! I need a bit of help creating a custom button in Web Access 9.2 that retrieves a field value off of a selected document and then uses that field value to generate and ultimately open a URL within the user's browser (as a new tab). Essentially, I'm trying to do exactly what is described in EDM 302: Advanced Web Customizations from Empower 2014 (within that course folder, see the Part 2 [URL integration by Field Value] Server DLL sub-folder).
The problem that I appear to be hitting is in trying to retrieve the active LFSO database object from the current Web Access session. Specifically, the following lines of code are erroring out:
// Retrieve the active LFSO database object from the current Web Access Session WebAccessSession WASession = WebAccessSession.GetSessionObject(); ILFDatabase db = WASession.ConnectionManager.GetLoggedInRepository();
To be precise, the last line is what throws the exception. The exception is:
(I got that error message to appear by changing the Empower course's sample CustomActions.xml file to `alert(err.get_message)` when `onWebServiceCallFail` is called. I get the error after clicking the custom toolbar button, which appears fine in my Web Access toolbar.)
Just in case it's helpful, here is the exact code that I'm running on my end:
(Note: In the .cs file, I've commented out the code to get the field value, just in my troubleshooting attempts to isolate the issue. FWIW: If I comment out all of the code that attempts to clone the user's connection, Web Access opens my hardcoded google.com link just fine. So, I know the problem is with the connection cloning code.)
As instructed in the course handout, I am recompiling the WebAccessCustomActions.dll file each time that I update CustomActions.cs, and I move the updated .dll into C:\Program Files\Laserfiche\Web Access\Web Files\bin).
In case it matters, the user in question does have access to the relevant template and field (which are named identically in my repository as they are in the course's sample code).
Right now I'm strictly trying to get the sample code from the Empower course to work in my environment. When I get this working, I'll work backwards to create my own custom button/action. That said, I haven't been able to get the course code working yet.
Any ideas?