Hi All,
I am quit stuck with an problem,
I have an Order which has a list of Line Items each Line Item has one Related Product
Order, Line Item, Product are data types.
Line Items has a data field Quantity and Product has a data field Inventory, both are numbers
Now; I want a database triggered workflow that allows me to modify the inventory when a Order changes the Order Status ( defined as a Option Set) in a way that before change Product´s Inventory minus the Line item´s Quantity.
I somehow am not able to get this right.
Could please anyone advise on how to tackle that problem 
thanks for your help
RG
Vik
romanmg
2
If you’re using a database trigger event that’s watching changes to your Order data type, you could do…
Condition on trigger event: Only when Order Before Change’s Status is not Order After Change’s Status (and Order After Change’s Status is [status you’re watching for])
Action: schedule a new API workflow on a list –
- type of list: line items
- list data source: Order After Change’s list of line items
- make sure the new API workflow has a parameter for Line Item so you can send “This Line Item” in the schedule action
Action within new workflow:
- Make a change to line item’s related product
- Quantity = this product’s inventory minus line item’s quantity
So basically what’s happening is when the order status changes, you schedule a new workflow on the list of line items. That way the new workflow can work with each product/line item relationship individually.
Hope this helps get you going!
Cheers,
Gaby
Coaching No Code Apps
2 Likes
Hi Gaby,
thanks for coming back to me. Maybe I am missing something but I can´t get it to work.
So just that you understand …
“Lagerbestand” = inventory and Anzahl = quantity (of the line Item)
the trigger condition should be correct.
I am not sure if I set up the API schedule correct:
I have the problem that I can not reference list and individual product.
if I make the parameter Line Item as a single thing.
I get an error on the side of the API side
and if I make it a list
I get the Error on the make a change to
so I got a problem with this
Action within new workflow:
- Make a change to line item’s related product
- Quantity = this product’s inventory minus line item’s quantity
“minus line item’s quantity” this is on a list and how do I reference without getting an error
had a sleepless night … . 
RG
Vik
Hi Gaby,
at the end I got it, I made the mistake that I thought that I had to relate to new Order
but now it´s working perfectly. thanks one more time for your help.
1 Like
romanmg
5
Perfect! Glad you were able to work through it 
system
Closed
6
This topic was automatically closed after 70 days. New replies are no longer allowed.