Skip to content

How to Manage Files in a Model

Article summary

Manage files in a model by making modifications to the data model and user interface. Using the example of adding the ability to attach files, such as contracts, to the Account entity in a CRM application, it describes the steps required to structure the data, create commands to handle files, and integrate a user interface for uploading and managing files.

This article explains how to manage files in a model by making modifications to the data model and user interface. Using the example of adding the ability to attach files, such as contracts, to the Account entity in a CRM application, it describes the steps required to structure the data, create commands to handle files, and integrate a user interface for uploading and managing files.

1. Create a new “contracts” field under Account:

Section titled “1. Create a new “contracts” field under Account:”
  • Type: New entity Contract

  • Is collection: Yes

2. Add the following fields to the Contract entity:

Section titled “2. Add the following fields to the Contract entity:”

Name: Text, to store the file name.

Type: Text, to store the file type.

Size: Number, to store the file size.

3. Create a command to add a new Contract entity:

Section titled “3. Create a command to add a new Contract entity:”
  • Select the new “contracts” field.

  • Add parameters: “name”, “type”, and “size”.

4. Create a command to delete a Contract entity.

Section titled “4. Create a command to delete a Contract entity.”

1. In the account page, in the UI, drag and drop the “Files” component from the toolbox.

Section titled “1. In the account page, in the UI, drag and drop the “Files” component from the toolbox.”

  • Files: “contracts” (select the field containing the entity representing a file).

  • Add file command: “addContrat” (select the creation command). Note: The component respects the command’s precondition and will block uploads if the precondition indicates it.

  • Name parameter: “name”.

  • Type parameter: “type”.

  • Size parameter: “size”.

  • Note: The component respects the command’s precondition and will block deletions if the precondition indicates it.

Managing files in a model combines adjustments to the data model and user interface. This approach enables seamless and robust integration for adding, displaying, and deleting files while adhering to defined business rules and constraints.