Logi’s variety of predefined elements allow developers the ease of selecting and configuring an element rather than hardcoding it. These out-of-the-box elements include charts, tables, graphs, and reports, as well as modules that support sophisticated business intelligence capabilities such as advanced charting, self-service capabilities, mobile readiness, and responsive design.
But what if you want to create a new process that references a web service not supported out of the box? With Logi’s advanced customization options, you can extend your platform using plugins.
Process Plugins to the Rescue!
Process plugins allow you to extend the functionality of your Logi applications. Other plugins may hook into the report rendering process at load time, during data manipulation, or right before the response HTML is sent to the client. But process plugins in particular are ad-hoc and scheduled at any time. They can be run online during the user’s session or offline during periods of infrequent system access.
How do I use a process plugin to send a report or visualization to a Slack channel?
In this tutorial, we will show you how to send a sample report to a Slack channel. Slack is an enterprise chat application that allows teams to communicate from anywhere and on any device.
For the purposes of this example, we assume the existence of a “Sales” Slack channel that we want to send the following report to:
The end result will allow the user to type a message—for example, “We hit $2 Million this quarter!”—and click the “Post Chart & Message to Slack.”
Here’s the resulting view in Slack:
Here’s how to get there:
Step 1: Write your code. When your plugin has been written and compiled, add the element(s) you need to call it in your Logi application (as outlined below).
The first time you run your Logi application, IIS will load the plugin to memory and it will remain cached there. If you make coding changes to the plugin and want to rebuild it, you’ll need to stop and restart IIS (run iisreset.exe) first, in order to be able to replace the previous build.
Step 2: Add a Process Plugin Element (Plugin.Slack in our example below)
Step 4: Click on Procedure Plugin Call
- Note: In this example, there are two Procedure Plugin Calls: One posting the image and the other posting the message to Slack.
Step 5: Specify Assembly name, which is the DLL of the Filename (.Net only). For Java plugins, instead of specifying the physical path to the JAR file, specify the full package name and class name.
Step 6: Specify ID
Step 7: Specify Method
Step 8: Specify Class Type Name (.Net only). Leave this attribute blank for Java plugins.
Step 9: Click Plugin Parameters
- Note: There are two parameters in this example, one for posting the image and the other for the message to Slack channel.
On the Visual Studio side, the code looks like this:
NOTE: Every project in Logi has a Bin directory and an rdPlugin DLL (.Net only). In your code you must reference the rdPlugin DLL and utilize the rdServerObjects class which allows you to communicate with Logi and make calls in and out of Logi. For Java plugins, you should add an external reference to PluginCaller.jar and utilize the LogiPluginObjects10 class, which is located in your Logi application’s WEB-INF/lib directory.
As shown above, there are two methods in the code and they call the rdServerObjects class (.Net only) which helps communicate with Logi. The code uses the URL access token and user name to be able to post the message on Slack. To upload the file on Slack, the code also uses a Slack API.