Integrate Laserfiche with URLs
Integrating a web-based application with Laserfiche does not need to involve writing complex programming code or even using the Laserfiche SDK. It is possible to create powerful ECM integrations with out-of-the-box Laserfiche Web Access functionality. Here is an example of how to create a comprehensive integration that allows users to view, search, retrieve and upload documents from an entirely different application with Laserfiche Web Access URLs alone.
In this article, we’ll use the example of Laserfiche University, which has a special intranet portal to display all university employee information.
The user experience
If an employee at Laserfiche University wants to see information about Clara Clerk, he can visit the portal and click on Clara’s profile. This will open a new page with information such as Clara’s title, department etc. etc.
As documents associated with Clara are scanned into Laserfiche with Laserfiche Scanning and reviewed by the quality control officer, they’re automatically made available in the Files section on Clara’s page. In this case, the employment application and emergency contacts have been scanned in.
Clicking on one of these documents opens it in Laserfiche Web Access. For example, here is what Clara’s emergency contact’s file looks like.
New employee documents can be scanned in directly from the main portal page by clicking the “Laserfiche Scanning” button on the front page.
It is also possible to search the Laserfiche repository directly from the university employee portal. Entering a search query and pressing Enter opens up Laserfiche Web Access with the list of results.
What’s happening behind the scenes
The whole integration is made possible with Laserfiche Workflow, Laserfiche Web Access URL linking and just a few small tweaks to Laserfiche University’s web page code. Let’s look at how the process works.
New documents are scanned into the repository, where a quality control officer reviews and indexes each file with the faculty ID number. After approval, Laserfiche Workflow moves those documents to the employee’s record folder in Laserfiche. Laserfiche Workflow also retrieves the employee ID number from the document’s metadata and uses it to run a query against the SQL database powering the faculty portal. The unique entry ID (note: this is a unique identifier for the document, assigned by the Laserfiche server; it is not the same as the faculty ID) for each document is then written to the database, in the column dedicated to that document type, on the row dedicated to that employee. In the screenshot below, you can find the entry IDs highlighted on the right.
Here is the workflow, which moves and renames the documents and updates the database.
The screenshot below illustrates how each of the Update Data activities is configured. First the appropriate row is found using the faculty ID, then the appropriate column has the document ID written to it.
Using this entry ID and a few known variables, it’s easy to construct a Laserfiche Web Access URL that will open up directly to the correct document. The template for creating a URL link to a document looks like this:
Since the server name and repository name will not change, they can be hard coded. That just leaves the entry ID to be plugged in dynamically. This can be done in a variety of ways, but because Laserfiche University’s faculty portal is written in PHP, here is an example of a method for constructing a full URL with PHP.
When the staff member’s profile page is loaded, a SQL query is run immediately to pull back all the information about the employee to populate the page. The page also includes the following code:
First, the code checks to see if the Application column for that employee has an entry ID or a 0. If it’s a 0 (the default), nothing will happen. If there’s a number besides a 0 (an entry ID), then the code inside of the curly brackets will be run.
This PHP statement is actually constructing our HTML code for us. If you’re familiar with HTML, you can probably follow along (though you may notice some extra backslashes; those are escape characters so that quote marks are handled as HTML and not PHP). Here’s a quick, color-coded key to what’s happening:
- Red creates the new cell.
- Orange formats information, so that things are centered and sized appropriately.
- Green is the link itself. You’ll notice there’s a blue section between the two link segments.
- Blue tells the page to place whatever entry ID it found in the Application column into the URL.
- Purple specifies that the link should be opened in a new tab.
- Brown creates the document icon and text that the user will click on to follow the link.
In the end, we get something that looks like this:
This links to:
The example outlined above is just one of many ways that URLs can be constructed dynamically. You may want to take a different approach, but regardless of the method you choose, it won’t be too difficult.
Searching via Laserfiche Web Access is also as simple as crafting a URL. The template for creating those URLs looks like this:
Your search query will need to be entered in as Advanced Search Syntax. It’s also possible to create your own search string easily by running a search in Laserfiche Web Access or the Laserfiche Client and then enabling the Advanced Search option to see the search syntax being passed to the server. Keep in mind, any query strings you use in your URL will need to be URL-encoded.
The option to scan in documents is also made possible with a URL. You can create your own Web Scanning link with the following template:
The final variable in that URL (destinationfolderid) is the entry ID of the folder into which you would like the documents scanned.
Benefits of integrating Laserfiche Web Access with URLs
Laserfiche Web Access URLs can be used in a variety of ways to create powerful integrations without needing to use the Laserfiche SDK or bother with the intricacies of coding for desktop applications. The examples above are just a starting point for the functionality you can create quickly and easily. Though it is necessary to do things slightly differently depending on which application is being used, the URL approach makes it easy to integrate with any web-based application.
Researching Laserfiche for your organization? Get a free demo to see more of what Laserfiche can do for you!