Framework
What is DocType

A Doctype is a core component in the LENS framework, representing the schema for data storage. It defines the structure of the data, including fields, field types, permissions, and more.

Every piece of data in a LENS application is stored within a Doctype, making them the backbone of the system's data management. The standard way to create a Docype is by typing new doctype in the search bar in the Desk.

Some Common DocTypes:
  • Customer: Stores information about customers.
  • Sales Invoice: Manages sales transactions.
  • Employee: Contains details about employees in an organization.
How Doctypes Work:

Fields and Field Types:

  • Each Doctype consists of multiple fields, and each field has a specific type (e.g., Text, Date, Link, Select).
  • Field types define the kind of data that can be stored in the field. For example:
    • Data: A simple text field.
    • Date: Stores date values.
    • Link: Creates a relationship with another Doctype.
    • Select: Allows selection from predefined options.

Naming and Identification:

  • Each record in a Doctype is uniquely identified by a name (which can be a system-generated ID).

Permissions:

  • Doctypes come with a built-in permission system, allowing you to control who can view, edit, create, or delete records within the Doctype.
  • Permissions can be role-based, ensuring that users have the appropriate access levels based on their role in the organization.
Exploring Default DocTypes:
  • Open the 'Doctype List' to see all available Doctypes.
  • Click on a few common Doctypes like 'Customer,' 'Sales Invoice,' or 'Item'.
  • Examine the fields, field types, and structure of each Doctype.
  • Notice how some fields in a Doctype link to other Doctypes (e.g., the Customer field in a Sales Invoice links to the Customer Doctype).
Create a DocType

Steps:

  1. Go to 'DocType List'.
  2. Click on 'Add Doctype' button.
  3. Give name for the DocType. (Eg: Product)
  4. Select the module based on your requirement. (Eg: Stock)
  5. Scroll to the fields section, click on 'Add row' to enter the fields for your DocType.
  6. Click 'Save'.

Create a New DocType

Have a doubt?
Post it here, our mentors will help you out.