Skip to content
Tutorials Center
My learning

Topics

Lesson 36 of 38 ยท Projects and Practice

Project: Inventory Model-driven App

Build a model-driven inventory app: tables and relationships, forms, views, business rules, a reorder command, dashboard and roles, with stand-ins that test the logic.

In this project you design a model-driven inventory app for a small warehouse team. It shows why model-driven apps fit data-heavy business tools: related tables, role-based access, forms and views, a dashboard and a custom command, with little UI design work.

The product cannot run on this site, so the steps describe the maker portal precisely and the key logic runs as stand-ins.

Requirements

  • Track products, their suppliers and stock movements (received, issued, adjusted).
  • Show the current quantity per product and flag items below their reorder level.
  • Warehouse staff record movements; managers see everything and can create purchase requests; viewers read only.
  • A dashboard shows low-stock products and movements by type this month.

Step 1: tables

In a solution with your publisher prefix (inv), create:

  • Supplier: Name, Email, Phone.
  • Product: Name, SKU (unique, use an alternate key), Supplier (lookup), Reorder Level (whole number), Quantity On Hand (whole number, updated by logic), Unit Cost (currency).
  • Stock Movement: Product (lookup), Type (choice: Received, Issued, Adjusted), Quantity (whole number), Moved On (date), Note.

Relationships: Supplier 1:N Product, Product 1:N Stock Movement. Make Product and Stock Movement user-owned for auditing, and Supplier organization-owned (a shared reference table).

A SKU alternate key prevents duplicates and lets imports update by SKU instead of by GUID.

Inventory data model

Supplier Who we buy from
Product Stock and reorder level
Stock Movement Received, issued, adjusted

Supplier 1:N Product 1:N Movement

1 / 2

Step 2: keeping quantity correct

Quantity On Hand must change when a movement is saved. You can do this with a Power Automate flow triggered when a Stock Movement is created (the Dataverse trigger "When a row is added, modified or deleted"), or with a rollup column on Product that sums movements: Received adds, Issued subtracts. A rollup is recalculated by the system on a schedule (about hourly) or on demand, so it is not instant; a flow updates immediately but needs care with concurrency (two simultaneous movements). For a small team a flow with concurrency control set to 1 is fine.

This stand-in applies movements and also demonstrates the idempotence problem: processing the same movement twice double counts.

JS Stand-in: apply stock movements

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Notice the negative-stock check; in Dataverse you would also add it as a business rule or a flow check so users get a clear message (Business Rules and Command Bar Commands).

Step 3: forms and views

  • Product main form: header with SKU, Quantity On Hand and Reorder Level; tabs General, Movements (a subgrid of Stock Movements) and Supplier (a quick view of the supplier).
  • Stock Movement quick create form: Product, Type, Quantity, Note. Add the + New button to the product's Movements subgrid so staff add movements from the product.
  • Views for Product: Active Products, Low Stock (filter: Quantity On Hand less than or equal to Reorder Level isn't possible as a column-to-column comparison in a view filter, so add a calculated column Is Low = QuantityOnHand <= ReorderLevel and filter Is Low = Yes), By Supplier (grouped or sorted by Supplier).

Dataverse calculated columns (or newer formula columns using Power Fx) can compare two columns of the same row; the view then filters on the result.

Step 4: a low-stock check and reorder suggestion

JS Stand-in: low-stock view and reorder quantity

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 5: command and dashboard

Add a command Create purchase request to the Product main form's command bar with a Power Fx action that creates a row in a Purchase Request table (Product, Quantity = Reorder Target minus On Hand, Status = Requested) and shows Notify("Purchase request created"). Make it visible only when Self.Selected.Item.'Is Low' is true.

Create the dashboard with a Low Stock list (the view) and a column chart of Stock Movements by Type for this month (a view filtered on Moved On = This Month).

Step 6: security roles

  • Warehouse Staff: Product Read at Organization (they must see all stock), Stock Movement Create/Read at User, Supplier Read.
  • Inventory Manager: all privileges on Product and Supplier at Organization, Stock Movement Read at Organization, Purchase Request Create.
  • Viewer: Read only everywhere.

Then add the app to each role via Manage roles in the app's sharing, and test with a user per role (Security Roles, Sharing and Row Access).

Step 7: ship it

Export managed, move through Test to Prod with a pipeline, and keep the app and tables in one solution (Solutions and Environments).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why add a calculated column Is Low?

    View filters compare a column to a value; a calculated column computes the comparison per row.
  2. 2. What problem does an idempotence guard prevent?

    Without a guard, retried flow runs can double count a movement.
  3. 3. Which key prevents duplicate SKUs and allows updates by SKU?

    An alternate key enforces uniqueness and can identify rows in imports.
  4. 4. Where should the Create purchase request button appear?

    Custom commands live on the command bar and use a visibility formula.

Summary

  • Model suppliers, products and movements; use an alternate key on SKU.
  • Keep quantity correct with a flow (with idempotence) or a rollup, and block negative stock.
  • Build forms, subgrids, a Low Stock view via a calculated column, a reorder command and a dashboard.
  • Secure with roles, test per role, and ship managed.

Next: Project: Application Lifecycle and Governance Plan