Form Definition and Examples

Form Layout Description

Capitalize Your Property Names

Always capitalize your property names in your forms. The property names are placed into the Flux flow context as flow context variables. Flow context variables are always capitalized.

{ Start of Form Declaration
type: “object”,
title: “Your Form Data”,
properties: {
Declare the form is an object.
Optional title for the form
Start point for declaring the form properties
(e.g., its fields)
STARTDATE: {
title: “Start Date”,
propertyOrder: 1,
type: “string”,
format: “date”,
description: “Start date for workflow”
},
Declare a specific property - i.e., startdate.
Optional title/label for the property
Optional order of the property against the other properties in the form
Type of property
Optional format of the property. In this case a date
Optional description to display of the property
Closing
TO_ADDRESS: {
title: “Mail To”,
propertyOrder: 2,
type: “string”,
description: “Support email address”
},
 
TIME_EXPRESSION: {
title: “Time Expression”,
propertyOrder: 3,
type: “string”,
description: “Time expression for workflow scheduled firings”
},
 
COMMENT: {
title: “Comment”,
propertyOrder: 4,
type: “string”,
min_length: 4,
default: “Enter a comment here”,
description: “Describe the purpose of this schedule”
},
Notice the test for a minimum length (min_length)
INTEGER: {
title: “Integer”, propertyOrder: 4,
type: “integer”,
minimum: 0,
maximum: 99,
options: { input_width: “100px” },
description: “Value with a range of 0-99 and restricted display width”
},
Notice the test for a minimum and maximum. 0 and 99 are included as valid values.
Here we limit the displayed length of the property using input_width
GENDER: {
type: “string”,
description: “Demonstrates a drop down list”,
enum: [ male, female ]
},
 
CHECKBOX: {
type: “array”,
format: “checkbox”,
uniqueItems: true,
items: {
type: “string”,
enum: [“male”, “female”]
},
description: “Demonstrates check box selection”
},
 
DATE: {
title: “Date”,
propertyOrder: 4,
type: “string”,
format: “date”,
description: “Demonstrates a date selection”
}
 
  } Close out the properties for this form
} Close out the form

Sample Forms

Specify some form properties

{
        "type": "object",
        "title": "Your Form Data",
        "properties": {
            "FORMTITLE": {
                "title": "Form Title",
                "propertyOrder": 1,
                "type": "string",
                "format": "string"
            },
            "FORMPROPERTIES": {
                "title": "List of Form Properties",
                "propertyOrder": 2,
                "options": {
                    "collapsed": false
                },
                "type": "array",
                "items": {
                    "title": "Form Property",
                    "type": "object",
                    "format": "grid",
                    "properties": {
                    "NAME": {
                        "title": "Name",
                        "type": "string"
                    },
                    "TITLE": {
                        "title": "Label",
                        "type": "string"
                    },
                    "TYPE": {
                        "title": "Type",
                        "type": "string"
                    },
                    "FORMAT": {
                        "title": "Format",
                        "type": "string"
                    },
                    "DESCRIPTION": {
                        "title": "Description",
                        "type": "string"
                    },
                    "DEFAULT": {
                        "title": "Default",
                        "type": "string"
                    }
                }
            }
        }
    }   
}

An Error Report Form

{
    "type": "object",
    "title": "Error Reporting Form",
    "properties": {
        "REPORTEREMAIL": {
            "title": "Reporter Email Address",
            "propertyOrder": 1,
            "type": "string",
            "description": "Your email address"
        },
        "ERROR": {
            "title": "Error Description",
            "propertyOrder": 2,
            "type": "string",
            "format": "textarea",
            "description": "Describe the error"
        }
    }
}

A Request Approval Form

{
    "type": "object",
    "title": "Request Approval Form",
    "properties": {
        "REQUEST": {
        "title": "Request",
        "propertyOrder": 2,
        "type": "string",
        "format": "textarea",
        "description": "Request description"
        },
        "APPROVAL": {
            "title": "Approve?",
            "propertyOrder": 8,
            "type": "array",
            "format": "checkbox",
            "uniqueItems": true,
            "items": {
                "type": "string",
                "enum": [
                "Approve",
                "Disapprove"
                ]
            }
        }
    }
}

Claiming Ownership

{
    "type": "object",
    "title": "Claim Ownership",
    "properties": {
        "USER": {
            "title": "User Name",
            "propertyOrder": 2,
            "type": "string",
            "format": "textarea",
            "description": "Request description"
        },
        "RELEASE": {
            "title": "Release Ownership?",
            "propertyOrder": 8,
            "type": "array",
            "format": "checkbox",
            "uniqueItems": true,
            "items": {
                "type": "string",
                "enum": [
                    "Release",
                    "Retain"
                ]
            }
        },
        "COMPLETE": {
            "title": "Completed?",
            "propertyOrder": 8,
            "type": "array",
            "format": "checkbox",
            "uniqueItems": true,
            "items": {
                "type": "string",
                "enum": [
                    "Yes",
                    "No"
                ]
            }
        }
    }
}

Specify a Command to Execute

{
    "type": "object",
    "title": "Command to Execute",
    "properties": {
        "COMMAND": {
        "title": "Specify a Command to Execute",
        "propertyOrder": 1,
        "type": "string",
        "default": "dir c:\\",
        "description": "Batch or OS Command to execute"
        }
    }
}

Specify a Database SQL Query to Execute

{
    "type": "object",
    "title": "Query to Execute",
    "properties": {
        "QUERY": {
        "title": "Specify a Database Query to Execute",
        "propertyOrder": 1,
        "type": "string",
        "format":"textarea",  
        "default": "select FLOW_CHART_NAME, STATE from FLUX_READY",
        "description": "SQL Query"
        }
    }
}

Specify a Password to Encrypt

{
    "type": "object",
    "title": "Password to Encrypt",
    "properties": {
        "PASSWORD": {
        "title": "Enter the password to encrypt",
        "propertyOrder": 1,
        "type": "string",
        "format": "password",
        "default": "aPassword",
        "description": "Encrypted password will appear on Dashboard"
        },
        "CONFIRMPASSWORD": {
        "title": "Confirm the password",
        "propertyOrder": 1,
        "type": "string",
        "format": "password",
        "default": "aPassword",
        "description": ""
        }
    }
}

Request a Value

{
    "type": "object",
    "title": "Enter some value to echo to console",
    "properties": {
        "VARNAME": {
        "title": "Specify a value to echo to console",
        "propertyOrder": 1,
        "type": "string",
        "default": "My Variable is Flux",
        "description": "Text to place into the variable"
        }
    }
}

Salary Processing Data Entry

{
    "type": "object",
    "title": "Salary Increase",
    "properties": {
        "DEPARTMENT": {
            "title": "Department Id",
            "propertyOrder": 1,
            "type": "string",
            "enum": [
                "Administration",
                "Athletics",
                "Deans"
            ],
            "description": "Select a department"
            },
        "INCREASE": {
            "title": "Salary Increase %",
            "propertyOrder": 1,
            "type": "number",
            "minimum": 0,
            "maximum": 50,
            "description": "Specify the salary increase %"
        },
        "CRITERIA": {
            "title": "Performance Criteria",
            "propertyOrder": 1,
            "type": "string",
            "format": "textarea",
            "default": "Meets expectations",
            "description": "Specify the performance criteria"
        },
        "CRITERIA_MET": {
            "title": "Performance Criteria Met?",
            "propertyOrder": 1,
            "type": "boolean",
            "format": "checkbox",
            "default": true
        }
    }
}

Adding Descriptive Text to a Field or a Comment

{
    "type": "object",
    "title": "A Field",
    "properties": {
        "FIELD": {
        "title": "Field",
        "propertyOrder": 1,
        "type": "string",
        "description": "This is a description of the field"
        }
    }
}

Or you can add a read-only text field with a default value

{
    "type": "object",
    "title": "A Comment",
    "properties": {
        "COMMENT": {
            "title": "Comment",
            "propertyOrder": 1,
            "type": "string",
            "default":"This is my comment",
            "readOnly": true,
            "description": "A Comment"
        }
    }
}

Form Sandbox

A “Sandbox” to experiment with your JSON forms is available here: https://pmk65.github.io/jedemov2/dist/demo.html