Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Visitor would request for demo by submitting a form in the Joget app.
  2. Upon submission of the form, fields will be validated to make sure that all mandatory fields are filled up.
  3. Upon successful validation of data, the form data will be shared with external system (i.e. CRM software) for further processing through the use plugins (i.e. JSON Tool) or Bean Shell code such as the sample:-. More on this later on.

  4. The main objective is to ensure successful delivery of data with the external system.

This is an example on how the form would look like.

Image Added

Figure 1

The only external factor that may be outside of the Joget platform's control would be the external integration with the CRM software. We will walkthrough a few scenarios on how best to design for this business use case with  UI/UX kept in mind.

Designing Solution

We will design the app and discuss where best to invoke the external API.

Preparing the Form and Userview

  1. We will start with desiging the form itself. The form itself is quite simple, with just 3 fields and all of them made mandatroy.
    Image Added
    Figure 2
  2. In the userview, we are making use of the Form Menu and link it to the form we have just designed.
    Image Added
    Figure 3
  3. Do not forget to create a CRUD menu too so that we can browse through all the submissions easily using Generate CRUD.
    Image Added
    Figure 4
  4. At this point of time, there's no integration yet with the external CRM.

What Happens on Form Submission?

When end user hits on the Submit button, the following will take place.

  1. Form Validation - Joget would iterate through each and every form element and invoking the validator (if configured).
    Image Added
    Figure 5

    If all validations pass, then it will move to the next step, else, end user will be redirected back to the same form with validation errors displayed like what is shown in the screenshot below.
    Image Added
    Figure 6

  2. Form Store - Since validations have passed, Joget will now proceed to the next step, form data will be passed to the store binder.
    Image Added
    Figure 7

    By default, the load/store binder is Workflow Form Binder where it will load and store form data into the table name declared in the form properties. In this case, the table name is "demo_request".
  3. Since we are using Workflow Form Binder, this would also mean that we are saving the form data locally in Joget's database.

With what we have learned so far, this can be presented using the following diagram.

Image Added
Figure 8

Invoke Restful API Call

There are many ways to do it. Here's a list.

  1. The easiest, no-code approach is to make use of JSON Tool 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 submission of form.
  2. We can also write Bean Shell code. Here's a quick sample code to make http get call.

    Code Block
    languagejava
    titleBean Shell code to make restful API calls sample
    linenumberstrue
    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://sample.joget.com/api";
    	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, "");
        }
    }
  3. The main objective is to ensure successful delivery of data with the external system.

This is an example on how the form would look like.

Image Removed

Figure 1

The only external factor that may be outside of the Joget platform's control would be the external integration with the CRM software. We will walkthrough a few scenarios on how best to design for this business use case with  UI/UX kept in mind.

Designing Solution

We will design the app and discuss where best to invoke the external API.

Preparing the Form and Userview

  1. We will start with desiging the form itself. The form itself is quite simple, with just 3 fields and all of them made mandatroy.
    Image Removed
    Figure 2
  2. In the userview, we are making use of the Form Menu and link it to the form we have just designed.
    Image Removed
    Figure 3
  3. Do not forget to create a CRUD menu too so that we can browse through all the submissions easily using Generate CRUD.
    Image Removed
    Figure 4
  4. At this point of time, there's no integration yet with the external CRM.

What Happens on Form Submission?

When end user hits on the Submit button, the following will take place.

...

  1. 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:-

    1. Bean Shell for Process Tool
    2. Bean Shell Validator
    3. Bean Shell Form Binder 


Possible Integration Points to Invoke Restful API Call

...

With what we have learned so far, this can be presented using the following diagram.

Image Removed
Figure 8

...

Post Form Submission Processing

...