Inventory validation with Order Capture App Sample

Hello, I am using the Order Capture App Sample, and I have been able to edit it so far. What I am trying to do is to validate the Inventory available with the request value. This means when I click on Save the order, I want to get a message like “The order you want to place cannot be saved because is not available in our inventory”, something like that. Since the App sample have the columns Total Available Total Request and Total Inventory, I think this is something I can do, but I dont know how. I am not sure if this is an Action or Behavior, or what exactly is. Thanks for your help.

Hi @okybrunner,

With the Order Capture sample app, To do that, you need to do:

  1. Create a virtual column in the Order Detail table, lets call this [Total Inventory]

  2. With formua:
    ANY(SELECT(Products[Total Available], [_THISROW].[Product ID]=[Product ID]))

  3. Still in the Order detail table, to the [Quantity], use Valid_If: [_THIS]<=[Total Inventory] and with Invalid value error : "The order you want to place cannot be saved because is not available in our inventory”

2 Likes

The virtual column isn’t strictly necessary:

[_THIS]<=ANY(SELECT(Products[Total Available], [_THISROW].[Product ID]=[Product ID]))
2 Likes

Ahhhhh… I see now… Thanks @Steve

1 Like

Thanks for your help, I will try that

Steve, where should I write that formula?

At the Valid_if of [Quantity], like my step#3.

1 Like