Versions Compared

Key

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

Template Types

Table of Contents
maxLevel2
minLevel2

Bean Shell

Template NameDescription
AJAX Options Binder
  • To dynamically load available options based on dependency value.

See guide here.

Template:

Code Block
languagejava
collapsetrue
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.LogUtil;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.service.FormUtil;

/**
* @param values - Dependency values of the controlling field.
*
* @return FormRowSet object which contains one or more FormRow object. 
* All FormRow objects are expected to have "value" and "label" property.
*/ 
public FormRowSet load(String[] values) {
    FormRowSet rows = new FormRowSet();

    if (values != null && values.length > 0) {
        String dependencyValue = values[0];

        // Continue your code here

        /* Sample code:
            FormRow option = new FormRow();
            option.setProperty(FormUtil.PROPERTY_VALUE, "sample-value");
            option.setProperty(FormUtil.PROPERTY_LABEL, "sample-label");
            rows.add(option);
        */
    }
     
    return rows;
}
 
return load(values);
Datalist Action
  • To execute logic as row action and/or bulk action in the datalist.

See guide here.

Template:

Code Block
languagejava
collapsetrue
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.LogUtil;
import javax.servlet.http.HttpServletRequest;
import org.joget.apps.datalist.model.DataList;
import org.joget.apps.datalist.model.DataListActionResult;

/**
* @param httpRequest - HTTP Request object of current HTTP Request.
* @param dataList - Datalist object of the current datalist
* @param rowKeys - A String array of record ID(s) for datalist row(s) that is selected for this action
*
* @return DataListActionResult object contains result for datalist to perform next
*/ 
public DataListActionResult executeAction(HttpServletRequest httpRequest, DataList dataList, String[] rowKeys) {
    DataListActionResult result = new DataListActionResult();
    result.setType(DataListActionResult.TYPE_REDIRECT);
    result.setUrl("REFERER");
    
    if (rowKeys != null && rowKeys.length > 0) {
        for (String key : rowKeys) {
            
            // Continue your code here
            
            /* Sample code:
                System.out.println(key);
            */
        }
    }
     
    return result;
}
 
return executeAction(httpRequest, datalist, rowKeys);
Datalist Formatter
Form Load Binder
Form Options Binder
Form Store Binder
Form Validator
Multirow Form Load Binder
Multirow Form Store Binder
Multirow Form Validator
Permission
Process Participant
Process Tool
Route Decision

...