Use a middle entity in EspoCRM when an Order-to-Product relationship needs price or other row-level data.
An Order and Product may look like a many-to-many relationship, but quantity, unit price, discount, and line notes belong to the relationship occurrence. Those values need their own record.
The example verified in this guide uses:
Order → Order Product Item → Product
Ebla Link Pro calls this the Middle Link pattern.
Requirements
This guide targets Ebla Link Pro 3.58 or later, EspoCRM 9.3 or later, and PHP 8.1 or later. Complete the setup in a test environment before migrating existing order data.
Why not use a direct many-to-many field?
Link Pro can display direct many-to-many fields and provide actions such as view, edit, unlink, and remove. It does not provide inline field editing for a direct many-to-many relationship.
Use a middle entity when each selected Product needs its own values.
Step 1: Create the Order Product Item entity
Open Administration → Entity Manager → Create Entity and create OrderProductItem using the
Base type.
Create the fields required by each row, for example:
| Label | Internal name | Type |
|---|---|---|
| Product | product | Link |
| Price | price | Float or Currency |
Add quantity, discount, tax, line-total, or note fields when the business process requires them. Apply validation and Formula rules appropriate to those fields.
Step 2: Create the relationships
From Entity Manager, create:
- A one-to-many relationship from Order to Order Product Item.
- A many-to-one relationship from Order Product Item to Product.
After saving, record the internal names of:
- the Link Multiple field on Order, such as
orderProductItems; - the Link field on Order Product Item that points to Product, such as
product.
Do not create a separate direct Order-to-Product many-to-many relationship for the same editable rows.
Step 3: Configure the Link Pro form
Open Administration → Entity Manager → Order → Fields → Order Product Items and:
- Enable Enable Form.
- Choose the detail and edit layouts.
- Enable Enable Select Button to let users choose existing Products.
- Set Middle Link (Act As Middle Entity) to
Product. - Enable Is Middle Link Unique when the same Product must not appear twice.
- Enable Open Middle Entity when row actions should open the Order Product Item instead of the final Product.
- Configure Copy Fields if Product values should be copied into the Order Product Item.
- Save the field.

Middle Link (Act As Middle Entity) identifies Product as the final record represented by each Order Product Item row.
Step 4: Configure the inline layout
Include fields that users need to understand or edit:
- Product;
- Price;
- any optional quantity, discount, tax, or line-total fields created for the process.
Keep calculated and protected fields read-only. Use the Link Pro Custom Layout setting when the Order Product Items list requires a dedicated column arrangement.
Step 5: Add the field to Order layouts
Add Order Product Items to the Order Detail and Edit layouts. Save the layouts and run Administration → Rebuild if the new metadata is not visible immediately.
Optional: copy Product values
Use Copy Fields when selecting a Product should initialize fields such as price or a tax
code on the Order Product Item.
Copied values are snapshots. Decide whether later Product changes should affect historical Order Product Items before enabling any automatic resynchronization.
Test the relationship
- Create an Order and select a Product.
- Confirm that one Order Product Item is created in the inline list.
- Enter the row price, then save the Order.
- Reopen both the Order and Order Product Item and verify their links.
- Try to select the same Product twice when uniqueness is enabled.
- Test create, edit, view, unlink, and remove actions with restricted user roles.
- Confirm whether row actions open the intended middle or final record.
Common problems
Product is selected but row fields cannot be edited
Confirm that Order uses the one-to-many orderProductItems field with Product selected as its
Middle Link. A direct many-to-many Products field does not support inline row editing.
The same Product appears more than once
Enable Is Middle Link Unique and verify that Product is the configured Middle Link.
Users can edit protected values
Add those fields to Link Pro Read-only Fields and enforce any security-critical rule on the server as well.