# Sales Opportunity Object Modeling and Forms

In the previous steps, we have defined the customer object and its attributes, and defined its list, creation, and update forms. Now we will proceed with the modeling and form definition for sales opportunities.

Referring to CRM System Design, we will define the attributes of sales opportunities as follows:

# Sales Opportunity Table (SalesOpportunities)

# Model Definition

# Interaction Record Table (InteractionRecord)

Field Name Type Nullable Default Options Remarks Related Object Type
name STRING No None None Interaction record key None
interactionType STRING No None None Interaction type None
interactionDate LOCAL_DATE No None None Interaction date None
notes STRING Yes None None Notes None

# Task Table (Task)

Field Name Type Nullable Default Options Remarks Related Object Type
name STRING No None None Task key None
description STRING No None None Description None
dueDate LOCAL_DATE No None None Due date None
status STRING No None None Task status None

# Sales Opportunity Table (SalesOpportunities)

Field Name Type Nullable Default Options Remarks Related Object Type
name STRING No None None Sales opportunity key None
customer DOMAIN_OBJECT No None None Related customer Customers
stage STRING No None None Opportunity stage None
expectedAmount BIG_DECIMAL No None None Expected amount None
expectedCloseDate LOCAL_DATE No None None Expected closing date None
interactionRecords DOMAIN_OBJECT_LIST Yes None None Customer interaction records InteractionRecord
tasks DOMAIN_OBJECT_LIST Yes None None Customer interaction records Task

Here's the creation process and related explanations:

  1. The customer field will be associated with the customer object we defined earlier. When creating this field, you need to select the type as DOMAIN_OBJECT and set its reference object type to Customers.
  2. We have set options for the interactionType field of InteractionRecord, the status field of Task, and the stage field of SalesOpportunities. You can directly input options in the Options column, pressing enter to input each option.
  3. SalesOpportunities references the interaction record table and task table, used to record a specific interaction with the customer or a to-do task. This type of object relationship is configured using DOMAIN_OBJECT_LIST.

# Form Definition

After completing the model definition, we will continue to define its list, creation, and update forms. The steps are as follows:

From the video, we can see that the Customer field in the sales opportunity list displays its ID rather than its name, which is not user-friendly. Now we will use the extInfo feature of DomainClass to set the Customer object to display its name attribute in other object forms that reference it.

The specific steps are as follows:

In the extension information field of the DomainClass definition for the Customer model, set:

{
  "labelField": "name"
}
1
2
3

This specifies that the name attribute of the Customer object will be displayed in forms of other objects that reference it.

The following data has a one-to-many relationship with SalesOpportunities, and the platform supports displaying related objects in sub-table form by default.

  • Interaction Records Table (InteractionRecords)
  • Tasks Table (Tasks)

However, when you click the create button on the SalesOpportunities list page and open the creation form, you'll find that you can't create related InteractionRecord and Task objects. The specific interface is shown in the image below:

Tutorial to create CRM on LCDP.ai: No interactionRecords and tasks create permission

This is because we haven't granted the user permission to create and edit InteractionRecord and Task objects.

Let's fix this permission issue. The solution is to create Create and Update forms for the InteractionRecord and Task models, and set their Enable Roles to the list of roles that should have permission.

The specific operation is shown in the video below, which also demonstrates data maintenance of the SalesOpportunity object after granting user permissions:

# Further Reading

Our platform is LCDP.ai Infinite Code, a low-code platform designed to help users quickly build information systems. To learn more about our platform, please visit LCDP.ai (opens new window).

Last Updated: 9/17/2024, 3:08:20 AM