Customizing Document Types for Developers

Introduction

Welcome to our detailed guide on customizing document types in Empress. This guide will provide you with an in-depth look at the Naming, Form Layout, and Permissions feature within the Empress platform. These features are critical for developers as they allow for customization, role-based access control, and a more intuitive user experience.

Section 1: Naming

In Empress, the default name value of a document is a randomly generated hash. However, a more human-friendly approach is to change the name of the document to the Article Name that we provide. This can be achieved by modifying the Auto Name field in the doctype list.

  1. Open the doctype list from the search bar and click on Article.
  2. Scroll down to the Naming section.
  3. In the Auto Name field, enter field:article_name.
  4. Click on Save.

Now, when you create a new Article, the name of the document will be the Article Name, and it must be unique across Articles. You cannot create another article with the same name.

You can also review the database records by running a select query in the MariaDB console. The following code snippet shows how you can do this:

MariaDB [_ad03fa1a016ca1c4]> select * from tabArticle;

This change ensures that each article has a unique, human-readable name, making it easier to manage and organize your data.

Section 2: Form Layout

Another aspect of customization is the layout of the fields in the form. A well-organized form layout can enhance the user experience and improve data input efficiency.

  1. Go to the Article doctype.
  2. Scroll to the Fields section.
  3. Add two new fields of type Column Break and Section Break.
  4. Hide the Image field as it is not needed to be shown in the form.

Additionally, you can also configure the Form Settings:

  1. Go to the Article doctype.
  2. Scroll down to the Form Settings section.
  3. Enter image in the Image Field. This will display the image at the left top of the form.
  4. Enable Allow Rename to allow renaming of documents.

By customizing the form layout and settings, you provide your users with a more intuitive and efficient data entry experience.

Section 3: Permissions

Finally, Empress provides you with the ability to configure roles and permissions for a DocType. This allows you to control access to certain functionalities based on the user’s role.

  1. Go to the Article doctype.
  2. Scroll down to the Permission Rules section.
  3. Add the roles. For example, you can add a Librarian role that has permission for all actions and a Library Member role that has permission for Read action.

By configuring roles and permissions, you can ensure that users have access to only the features they need, enhancing system security and user experience.

Conclusion

The Naming, Form Layout, and Permissions features of Empress are powerful tools for developers. They allow for customization, role-based access control, and a more intuitive user experience, enabling you to develop business solutions tailored to your specific needs. By taking advantage of these features, you can ensure that your software solution is efficient, secure, and user-friendly.