|
| 1 | +--- |
| 2 | +review-status: needs-review |
| 3 | +review-date: 2025-08-29 |
| 4 | +reviewer: migration-script |
| 5 | +migration-notes: "Added during 2025 documentation reorganization" |
| 6 | +--- |
| 7 | + |
| 8 | +# Custom Fields |
| 9 | + |
| 10 | +Custom fields are a powerful feature in OpenSPP that allow administrators to add new data fields to registrant profiles without requiring developer intervention. They can be used to capture additional information that is specific to a program's needs, such as a secondary contact number, a disability status, or any other piece of data not included in the standard OpenSPP setup. |
| 11 | + |
| 12 | +This guide provides step-by-step instructions on how to create a simple custom field using the **Custom Fields UI**. We will create a field to store a "Secondary Phone Number" for an individual. |
| 13 | + |
| 14 | +```{note} |
| 15 | +The Custom Fields UI is designed for creating straightforward, user-defined fields for direct data entry. For fields that require automatic calculation or complex logic, see the {doc}`indicator_fields` guide. |
| 16 | +``` |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +To create and manage custom fields, you need: |
| 21 | +- A user account with the **System Admin** role. For more details, see the {doc}`user_access` guide. |
| 22 | +- The **OpenSPP Custom Fields** (`spp_custom_field`) and **OpenSPP Custom Fields UI** (`spp_custom_fields_ui`) modules must be installed and activated in your OpenSPP instance. |
| 23 | + |
| 24 | +## Objective |
| 25 | + |
| 26 | +After completing this tutorial, you will understand how to create, configure, and verify a custom field in OpenSPP. |
| 27 | + |
| 28 | +## Process |
| 29 | + |
| 30 | +The process involves navigating to the Custom Fields menu, defining the properties of the new field, and verifying its presence on the individual records. |
| 31 | + |
| 32 | +### Navigate to Custom Fields |
| 33 | + |
| 34 | +First, access the Custom Fields management interface. |
| 35 | +1. Click on the menu icon in the top-left corner and select **Registry**. |
| 36 | +2. In **Registry**, click the **Configuration** menu. |
| 37 | +3. Click on the **Custom Fields** sub-menu. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +### Create a New Field |
| 42 | + |
| 43 | +On the **Custom Fields** page, you will see a list of existing custom fields. |
| 44 | +1. Click the **New** button to start creating a new custom field. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +The **Custom Fields** form view will appear. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +### Configure Basic Properties |
| 53 | + |
| 54 | +Now, define the basic characteristics of your new custom field. For this example, we are adding a secondary phone number field for individuals. |
| 55 | + |
| 56 | +- **Field Draft Name**: Enter a technical name for the field, such as `secondary_phone`. This name should be unique and follow standard naming conventions (lowercase with underscores). |
| 57 | +- **Field Label**: Provide a user-friendly label, like `Secondary Phone Number`. This is what users will see on the interface. |
| 58 | +- **Field Type**: Select `Char`, as a phone number is best stored as a text string. |
| 59 | +- **Target Type**: Choose `Individual`, because the field will be added to each individual's record. |
| 60 | +- **Field Category**: Select `Custom`. This designates the field as a standard data entry field. |
| 61 | +- **Field Help**: Specify a text that will appear as a tooltip or description for the field, for example, "Enter an alternative phone number for the individual." |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +### Configure Properties (Optional) |
| 66 | + |
| 67 | +Since this is a standard custom field, you do not need to provide computation logic. However, you can configure its behavior in the **Properties** tab. |
| 68 | + |
| 69 | +- **Required**: Check this box if you want to make this field mandatory for all records. |
| 70 | +- **Readonly**: Check this box to prevent users from editing the field's value through the user interface. |
| 71 | +- **Index**: For performance optimization on large datasets, a developer or system administrator can enable this. |
| 72 | +- **Copied**: Determines if the value of this field is copied when a record is duplicated. |
| 73 | + |
| 74 | +For our example, we will leave these options unchecked. |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | +### Save and Open an Individual Record |
| 79 | + |
| 80 | +Once all properties are configured, save the new field. |
| 81 | + |
| 82 | +1. Click the **Save** button. Odoo will create the new field in the database. |
| 83 | +2. Navigate to the **Registry** and click the **Individuals** menu. |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | +### Verify the Custom Field |
| 88 | + |
| 89 | +1. To verify, open any record in the **Individuals** list view. |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | +2. A new tab named **Additional Details** will appear on the form. Click on it. |
| 94 | + |
| 95 | +3. You should see your new "Secondary Phone Number" field, ready for data entry. |
| 96 | + |
| 97 | + |
0 commit comments