Come join us on November 27-29, 2018 at the Gartner Application Strategies & Solutions Summit 2018 in Las Vegas, USA.
Take note of the "Post Processing Tool" attribute in a form builder's properties. We can see that it is listing down a list of Process Tool plugin for App Designer to choose.
Introducing the property definition type and configurations
We can trace this behavior to the property definition file "form.json" - https://github.com/jogetworkflow/jw-community/blob/6.0-SNAPSHOT/wflow-core/src/main/resources/properties/form/form.json#L81
This is the excerpt of the file that is responsible to generate such dropdown selection.
You will need to include such definition in your plugin's property definition file.
Explanations on the property definition code
Line 4 - Attribute "type" with the value set to "elementselect" is important to tell the property editor on how to handle the selection. A new tab will be created automatically upon a selection made.
Line 5 - Attribute "options_ajax" with the service URL set is responsible to load all the plugin tied to "org.joget.plugin.base.ApplicationPlugin" (Process Tool) into the selection. You may change the value to load the appropriate type of plugin you want.
[CONTEXT_PATH] is a special variable that will be replaced automatically at runtime with the Joget web app context information. (e.g.)
Line 6 - With the value in Line 4 set, the property editor will make a call to this URL, passing along the selection made. (e.g. http://localhost:8080/jw/web/property/json/expenseclaim/1/getPropertyOptions?value=org.joget.apps.app.lib.EmailTool)
[CONTEXT_PATH] is a special variable that will be replaced automatically at runtime with the Joget webapp context information. (e.g.)
[APP_PATH] is a special variable that will be replaced automatically at runtime with the Joget App context information. (e.g. /expenseclaim/1)
Line 7 - Attribute "default_property_values_url" is optional but recommended to be included. When a new tab is created for the configurations of the selected plugin, default values will be loaded to ease and shorten the time in configuring.
After a selection is made
After a selection is made, we can then see a new tab is added. We can also see that there are default values being loaded because of the inclusion of attribute "default_property_values_url" earlier.
How to retrieve the configurations set and run the plugin?
Using back the sample, we can refer to the code at https://github.com/jogetworkflow/jw-community/blob/6.0-SNAPSHOT/wflow-core/src/main/java/org/joget/apps/form/service/FormUtil.java#L1932. Refer to the code of the method "executePostFormSubmissionProccessor".
Essentially, we will just need these few lines in our own plugin to get it to work.
If we need to grab the plugin's default properties or to inject appDef, request object, etc then these excerpts from the method "executePostFormSubmissionProccessor" becomes necessary.