1. Create a detail object schema
- Go to the Configuration section and select a custom package to add the schema.
-
Click Add → Object in the section list toolbar.
-
Fill out the schema properties.
- Set Code to "UsrCourierService."
- Set Title to "Courier service."
- Select "BaseEntity" in the Parent object property.
-
Add a column that stores the order to the schema.
- Click
in the context menu of the object structure’s Columns node.
-
Click Lookup in the drop-down menu.
-
Fill out the properties of the added column.
- Set Code to "UsrOrder."
- Set Title to "Order."
- Select "Order" in the Lookup property.
- Click
-
Add a column that stores the account to the schema in a similar way.
- Click
in the context menu of the object structure’s Columns node.
- Click Lookup in the drop-down menu.
-
Fill out the properties of the added column.
- Set Code to "UsrAccount."
- Set Title to "Account."
- Select "Account" in the Lookup property.
- Click
- Click Save then Publish on the Object Designer’s toolbar.
2. Create a view model schema of the detail
- Go to the Configuration section and select a custom package to add the schema.
-
Click Add → Detail (list) view model on the section list toolbar.
-
Fill out the schema properties.
- Set Code to "UsrCourierServiceDetail."
- Set Title to "Courier service in Order detail schema."
- Select "BaseGridDetailV2" in the Parent object property.
-
Add a localizable string.
- Click the
button in the context menu of the Localizable strings node.
-
Fill out the localizable string properties.
- Set Code to "CourierServiceCaption."
- Set Value to "Courier service."
- Click Add to add a localizable string.
- Click the
-
Implement an editable detail list.
- Add the ConfigurationGrid, ConfigurationGridGenerator, ConfigurationGridUtilitiesV2 module schemas as dependencies.
- Add the ConfigurationGridUtilitiesV2 mixin to the mixins property.
- Add the IsEditable attribute to the attributes property. Set the value property of the attribute to true.
- Add the configuration object to the diff array of modifications. This object must have the property settings and binding of the detail list events' handler methods.
View the source code of the UsrCourierServiceDetail view model schema of the detail below.
- Click Save on the Module Designer’s toolbar.
3. Create a replacing view model schema of the order page
- Go to the Configuration section and select a custom package to add the schema.
-
Click Add → Replacing view model on the section list toolbar.
-
Fill out the schema properties.
- Set Code to "OrderPageV2."
- Set Title to "Order edit page."
- Select "OrderPageV2" in the Parent object property.
-
Add the custom UsrCourierServiceDetail detail to the order page.
- Add the UsrCourierServiceDetail detail to the details property.
- Add a configuration object with the settings that determine the detail layout to the diff array of modifications.
View the source code of the order page’s replacing view model below.
- Click Save on the Module Designer’s toolbar.
4. Register the custom detail in the database
To make the detail visible in the Section Wizard and Detail Wizard, register it in the database. To do this, execute the SQL query to the [SysDetails] database table.
Outcome of the example
To view the outcome of the example:
- Refresh the Orders section page.
- Open an order page and go to the Delivery tab.
As a result, Creatio will add the custom Courier service detail to the Delivery tab of the order page. The detail displays the index of available courier services (the values of the Account lookup) for the current order (the Order column). The order is populated automatically.
