Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
...
Upon successful validation of data, the form data will be shared with an external system (i.e. CRM software) for further processing through the use of plugins (i.e. JSON API for Mapping Tools to PluginsTool) or Bean Shell code. More on this later on.
...
...
The easiest, no-code approach is to make use of JSON API for Mapping Tools to PluginsTool plugin itself. The JSON Tool itself is a Process Tool & Post Form Submission Processing Plugin. This means that we can invoke it from within a process flow or from the submission of the form.
...
We can also write Bean Shell code. Here's a quick sample code to make HTTP get call.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import java.io.IOException; import org.joget.commons.util.LogUtil; try{ String jsonUrl = "http://localhost:8080/jw/web/json/workflow/assignment/list/count?packageId=crm"; //sample url String name = "header1"; String value = "value1"; CloseableHttpClient client = null; CloseableHttpClient client = HttpClients.createDefault(); HttpRequestBase request = null; request = new HttpGet(jsonUrl); request.setHeader(name, value); HttpResponse response = client.execute(request); } catch (Exception ex) { LogUtil.error(getClass().getName(), ex, ""); } finally { try { if (request != null) { request.releaseConnection(); } if (client != null) { client.close(); } } catch (IOException ex) { LogUtil.error(getClass().getName(), ex, ""); } } |
We can execute this piece of code from various plugin types giving us the flexibility on where/when we want to invoke it. The only disadvantage compared to the former is that we need to maintain the custom coding ourselves instead of configuring through a plugin. These are the plugin types relevant to our solution to call the code from:-
...
By using Post Form Submission Processing in Form, and "Method 1 JSON Call" earlier, this is the easiest and quickest method. This allows us to invoke any Process Tool & Post Form Submission Processing Plugin. JSON API for Mapping Tools to PluginsTool is one such candidate.
Figure 9
...
Taking cues from method 2 earlier, we will put the new plugin in Multi Tools and set the Run Mode to "Run tools sequentially in a new single thread". This is so that customer does not need to wait for JSON call to complete.
Figure 13
The following is a new section to configure to capture the JSON call's response status.
...