DocType
The DocType is a core concept that represents the data structure of the relational databases in the platform. It defines the fields, behaviors, and rules for a specific type of document or record within the system.
Overview
Purpose: The DocType is used to define the structure and behavior of documents in TechMaju. It allows developers to create and customize various forms and records, enabling dynamic data management.
Function: The DocType enables developers to:
Define the fields and properties of a document.
Set up custom behaviors and rules for document processing.
Organize data into structured records that can be managed, searched, and reported on.
Docstatus
Every DocType uses the concept of a "Docstatus" to keep track of the status of documents. The docstatus will always have one of the following three values:
Draft (value: 0)
Submitted (value: 1)
Cancelled (value: 2)
Documents that are not submittable will always remain in the "draft" state. Documents that are submittable can optionally proceed from the draft state to the "submitted", and then to the "cancelled" state.
Documents in the submitted and cancelled state cannot be edited, with one exception: for individual fields we can explicitly allow edits, even when the document is in the submitted state.
The docstatus gets stored as an integer value in each Doctype table of the database.
Role Required
System Manager: Can create, write, and delete DocTypes.
Create New DocType Fields
Field | Description |
|---|---|
DocType Name | The name of the DocType. |
Application | The application to which this DocType belongs. |
Is Submittable | Indicates if the document can be submitted, making it immutable except for cancellation and amendment. |
Is Child Table | Indicates if the DocType is a child table, shown as a grid in other DocTypes. |
Is Single | Indicates if the DocType has only one record with no associated tables. |
Is Tree | Indicates if the DocType uses a nested set for tree structures. |
Is Virtual | Indicates if the DocType is virtual, with data not stored in the database. |
Procedure
Navigate to Develop > DocType.
Creating a New DocType:
Click on '+ Add DocType'.
Fill in the required fields such as DocType Name and Application.
Configure additional options like submittable, child table, single, tree, and virtual as needed.
Click on 'Create & Continue'.
Configure doctype settings.
Customize the form by adding sections and fields.
Save:
Once all settings are configured, save the DocType.
Best Practices
Configuring DocType should be done in the Development environment so that changes are captured in source control and can be properly promoted.
Avoid making any direct changes to non-custom DocTypes such as TechMaju Core application module since these changes will not be deployable to higher environments. Instead use Customize Form and Custom Fields.
Use meaningful naming rules since DocType names can conflict if they are the same so append any prefixes for DocType names that are common names and could conflict in the future.
Renaming DocTypes are doable but highly risky - especially if the DocType is mature where many relationships exist that could potentially break.
Deleting DocTypes are considered high risk, thus, it can only be done as the Administrator user. Be very careful and plan out whether you would want to delete DocTypes as it could cause errors if it is highly tied to other artifacts.