Versions Compared

Key

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

...

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
  • To transform values in the datalist column.

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.datalist.model.DataList;
import org.joget.apps.datalist.model.DataListColumn;
import org.joget.apps.datalist.service.DataListService;

/**
* @param dataList - Datalist object of the current datalist
* @param column - The current datalist column object
* @param row - The data object of current record row in the datalist.
* @param value - The value of current cell in the datalist.
*
* @return String formatted string value to replace the original cell value
*/ 
public String format(DataList dataList, DataListColumn column, Object row, Object value) {
    String formattedValue = "";
    if (value != null) {
        formattedValue = value.toString();
    }

    // Continue your code here

    /* Sample code:
        Object otherColumnValue = DataListService.evaluateColumnValueFromRow(row, "columnId");
    */
     
    return formattedValue;
}
 
return format(datalist, column, row, value);
Form Load Binder
  • To dictate how form data should be loaded.

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.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
   
/**
* @param element - Element that this binder is tie to
* @param primaryKey - The primary key provided by the element to load data
* @param formData - The data holder of the whole form
*
* @return FormRowSet object which contains one FormRow object. 
*/  
public FormRowSet load(Element element, String primaryKey, FormData formData) {
    FormRowSet rows = new FormRowSet();
    if (primaryKey != null && !primaryKey.isEmpty()) {
        FormRow row = new FormRow();
        rows.add(row);

        // Continue your code here

        /* Sample code:
            row.setId(primaryKey);
            row.setProperty("fieldId", "field value");
        */
    }
    return rows;
}

return load(element, primaryKey, formData);
Form Options Binder
  • To populate a form element's options based on their own requirements and sources.

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.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.service.FormUtil;

/**
* @param element - Element that this binder is tie to
* @param formData - The data holder of the whole form
*
* @return FormRowSet object which contains one or more FormRow object. 
* All FormRow objects are expected to have "value" and "label" property.
*/ 
public FormRowSet load(Element element, FormData formData) {
    FormRowSet rows = new FormRowSet();

    // 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(element, formData);
Form Store Binder
  • To dictate how form data should be stored.

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.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
import org.joget.apps.form.model.FormStoreBinder;
import org.joget.plugin.base.PluginManager;
   
/**
* @param element - Element that this binder is tie to
* @param rows - Data to be store. Contains only one FormRow object
* @param formData - The data holder of the whole form
*
* @return FormRowSet object which stored.
*/  
public FormRowSet store(Element element, String rows, FormData formData) {
    
    // Continue your code here

    /* Sample code:
        //Reuse Workflow Form Binder to store data
        PluginManager pluginManager = (PluginManager) AppUtil.getApplicationContext().getBean("pluginManager");
        FormStoreBinder binder = (FormStoreBinder) pluginManager.getPlugin("org.joget.apps.form.lib.WorkflowFormBinder");
        binder.store(element, rows, formData);
    */

    return rows;
}

return store(element, rows, formData);
Form Validator
  • To validate the value of a form element.

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.Element;
import org.joget.apps.form.model.Form;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.service.FormUtil;

/**
* @param element - Element that this validator is tie to. 
* @param formData - The data holder of the whole form.
* @param values - The submitted values of the element.
*
* @return boolean value to indicate the validation pass or fail.
*/  
public boolean validate(Element element, FormData formData, String[] values) {
    boolean result = true;
 
    // Continue your code here

    /* Sample code:
        if (values == null || values.length == 0 || values[0].isEmpty()) {
            String id = FormUtil.getElementParameterName(element);
            formData.addFormError(id, "Value cannot be empty!!");
            result = false;
        }
    */
 
    return result;
}
 
return validate(element, formData, values);
Multirow Form Load Binder
  • To dictate how form data in a grid-type element should be loaded.

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.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
   
/**
* @param element - Element that this binder is tie to
* @param primaryKey - The primary key provided by the element to load data
* @param formData - The data holder of the whole form
*
* @return FormRowSet object which contains one or more FormRow object. 
*/  
public FormRowSet load(Element element, String primaryKey, FormData formData) {
    FormRowSet rows = new FormRowSet();
    rows.setMultiRow(true);

    if (primaryKey != null && !primaryKey.isEmpty()) {
        FormRow row = new FormRow();
        rows.add(row);

        // Continue your code here

        /* Sample code:
            row.setId(primaryKey);
            row.setProperty("fieldId", "field value");
        */
    }
    return rows;
}

return load(element, primaryKey, formData);
Multirow Form Store Binder
  • To dictate how form data in a grid-type element should be stored.

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.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
import org.joget.apps.form.model.FormStoreBinder;
import org.joget.plugin.base.PluginManager;
   
/**
* @param element - Element that this binder is tie to
* @param rows - Data to be store. Contains only one or more FormRow object
* @param formData - The data holder of the whole form
*
* @return FormRowSet object which stored.
*/  
public FormRowSet store(Element element, String rows, FormData formData) {
    
    if (rows != null && !rows.isEmpty()) {

        // Continue your code here

    }

    return rows;
}

return store(element, rows, formData);
Multirow Form Validator
  • To validate the value of a grid-type form element.

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.Element;
import org.joget.apps.form.model.Form;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.service.FormUtil;

/**
* @param element - Element that this validator is tie to. 
* @param rows - Submitted data. Contains one or more FormRow object.
* @param formData - The data holder of the whole form.
*
* @return boolean value to indicate the validation pass or fail.
*/  
public boolean validate(Element element, FormRowSet rows, FormData formData) {
    boolean result = true;
 
    // Continue your code here

    /* Sample code:
        if (rows == null || rows.isEmpty()) {
            String id = FormUtil.getElementParameterName(element);
            formData.addFormError(id, "Value cannot be empty!!");
            result = false;
        }
    */
 
    return result;
}
 
return validate(element, rows, formData);
Permission
  • To define who is authorized to access a component of an app.

See guide for Form Permission and Userview Permission.

Template:
Code Block
languagejava
collapsetrue
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.LogUtil;
import java.util.Map;
import org.joget.directory.model.User;

/**
* @param user - User object of current logged in user
* @param requestParams - Request parameters map of current HTTP Request
*
* @return boolean value to indicate the user is authorized.
*/  
public boolean isAuthorized(User user, Map requestParams) {
    boolean isAuthorized = true;

    // Continue your code here
     
    return isAuthorized;
}

return isAuthorized(user, requestParams);
Process ParticipantTemplate:
Code Block
languagejava
collapsetrue
Process Tool
  • To assign Joget users to represent a participant in a process.

See guide here.

Template:
Code Block
languagejava
collapsetrue
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.LogUtil;
import org.joget.workflow.model.WorkflowActivity;
import java.util.ArrayList;
import java.util.Collection;

/**
* @param workflowActivity - Workflow Activity that trying to retrieves assignee.
*
* @return Collection of username in String to be assign to the Workflow Activity.
*/  
public Collection getAssignees(WorkflowActivity activity) {
    Collection assignees = new ArrayList();

    // Continue your code here

    /* Sample code:
        assignees.add("admin");
    */
     
    return assignees;
}

return getAssignees(workflowActivity);
Process Tool
  • To execute logic as a Process Tool in a process.

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.app.model.AppDefinition;
import javax.servlet.http.HttpServletRequest;
import org.joget.workflow.model.WorkflowAssignment;

/**
* @param workflowAssignment - The workflow tool activity assignment object.
* @param appDef - App definition of the process.
* @param request - Http Request object of current HTTP Request. Not available if the tool is trigger by Deadline.
*
* @return null
*/  
public Object execute(WorkflowAssignment assignment, AppDefinition appDef, HttpServletRequest request) {
    
    // Continue your code here
     
    return null;
}

return execute(workflowAssignment, appDef, request);
Route Decision
  • To dictate the flow of the process.

See guide here.

Template:
Code Block
languagejava
collapsetrue
import org.joget.apps.app.service.AppUtil;
import org.joget.commons.util.LogUtil;
import java.util.Map;
import org.joget.workflow.model.DecisionResult


/**
* @param processDefId - The process definition id
* @param processId - The process instance id
* @param routeId - The current route id
* @param variables - Workflow variables 
*
* @return DecisionResult for the process to decide transition to flow next 
*/  
public DecisionResult getDecision(String processDefId, String processId, String routeId, Map variables) {
    DecisionResult result = new DecisionResult();
    
    // Continue your code here

    /* Sample code:
        result.addTransition("approved");
    */

    return result;
}
 
return getDecision(processDefId, processId, routeId, variables);
Route Decision
Template:true
Code Block
languagejava
collapse

CSS

Panel

Write CSS here.

Code Block
languagecss
titleExample
div#container {
	display: block;
	color: red;
}

p.container-text {
	color: blue;
}

...