Over the next few weeks, I’ll be posting a walk-through which will outline building a Workslips module for SageCRM. In this part, I’ll cover creating a new table, and defining fields in that table.
We’re going to start with creating new table structure to hold basic Workslip information. First we have to define the Workslip table. In SageCRM, got to Administration->Advanced Customization->Tables and Databases and then click the “Create Table” button
This will open the for where we enter the table details:
We’ll set the following properties:
- Table Name: Workslip
- ID Field Name: Workslip_WorkslipID (Primary key for table)
- Top Level Entity: Yes
- Company Id Field: Workslip_CompanyID (Foreign key to Company table)
- Table Caption: Workslip
- Column Prefix: Workslip (All fields defined in this table will be prefixed by “Workslip_”)
- Person Id Field: Workslip_PersonID (Foreign key to Person table)
- User Id Field: Workslip_UserID (Foreign Key to User table)
- Solo Options: Filter by Company/Person
Click the “Save” button to create the new table.
Now that the table has been created, we have to define the fields in the table. Under Administration->Customization, we should now see the new Workslip Entity under the Primary Entities. Click “Workslips” and make sure you are on the “Fields” tab. Click the “new” button to add fields.
In SageCRM, the individual field definitions contain format settings that define which control is used, and how the control will ultimately be rendered in the client. We’re just going to add a couple fields for now.
The first field we will add is a memo-style, description field:
The field type of “Multiline Text” will display a multi-line memo field. Set the width and height to define the size of the control once it is added to a form.
Next, we will add a Workslip Number field:
This is just a standard text field, with Max Length and Width fields defined as well.
Additional fields can be added as required. Definitions of other field types can be found here. System fields, such as the foreign keys for Company, Person and user numbers have been already created for you. I’ll be adding some additional fields, and in the next post for this walkthrough, we’ll start getting into creating Lists and Screens.
Thanks for reading! [:)]