Overview

DynaForms inside ProcessMaker version 3 have the option to be exported and imported from the designer. The DynaForms are exported in .json format containing the definition of all the controls and properties included in the design. When importing a DynaForm, the file must contain the json definition of the DynaForm and its controls and properties will be included and rendered in the form.

Exporting a DynaForm

The DynaForm designer includes the option to export a DynaForm in the menu at the top right side of the window

By clicking on this option a .json file downloads containing the definition of the controls and properties included in the form. The name of the file has the format NameDynaForm.json. The elements downloaded in the file are:

For example, the json definition of a DynaForm with a Text control that has a variable related would be:

{"name":"Employee Request", "description":"", "items":[{"type":"form", "id":"1619873045550e531470b73029369295", "name":"Employee Request", "description":"", "mode":"edit", "script":"", "language":"en", "externalLibs":"", "items":[[{"type":"text", "variable":"EmployeeName", "dataType":"string", "id":"EmployeeName", "name":"EmployeeName", "label":"text_1", "defaultValue":"", "placeholder":"", "hint":"", "required":false, "dependentFields":[], "textTransform":"none", "validate":"", "validateMessage":"", "maxLength":1000, "formula":"", "mode":"parent", "operation":"", "dbConnection":"workflow", "dbConnectionLabel":"PM Database", "sql":"", "options":[], "var_uid":"3959960935550eed0191762082100042", "var_name":"EmployeeName", "colSpan":12} ]

Importing a DynaForm

Inside the DynaForm designer of ProcessMaker version 3, it is not only possible to export the definition of the DynaForm but it is also possible to import an entire DynaForm by importing a .json file that contains the definition of the elements included in the form.

Take into account that when importing a DynaForm from a .json file, the entire content of the DynaForm where it is imported is replaced by the definition of the DynaForm. That is the reason why it is recommended as a first step, to create a new blank DynaForm and make the import there so no elements are lost in the process.

The option to import a DynaForm is included at the top right side of the DynaForm designer:

When the Dynaform to be imported is empty, only the window to select the .json file opens and after selecting it, the import of the elements is done.

When the DynaForm to be imported has controls previously added, then a message window is shown indicating that when importing all elements will be lost:

To import the DynaForm losing all changes, click on "Yes". Click on "No" to not import the DynaForm and keep the controls already added in the DynaForm.

When a dynaform is imported over an existing dynaform, all the configuration of the existing dynaform is overwritten. Therefore, an alert message is displayed at the beginning saying that all the current dynaform is going to be replaced by the new one.

Additionally, the import process scan the variables that are related to the dynaform controls and defined in the process with the variables that are included in the .JSON definition of the dynaform that is being imported.

The imported process tries to reuse the existing variables (variables with the same name) in the process and if a new variable is imported, then it is automatically created in the process. If the variable already exist in the process then the following variable properties are compared to define if the form can use the existing variables:

  • Name
  • Type
  • DB Connection
  • SQL Query
  • Options

If any of the properties is different then a new variable needs to be created. The new variable is created with the same name plus the suffix “_1”. And the dynaform changes the references to the new created variables. The following dialog is display: