cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lucas_Ignatius
Helper IV
Helper IV

Inventory Update Quantity on SharePoint (Sub Function)

Hi Everyone,

I need help for how to update inventory quantity on SharePoint List

I have 2 SharePoint List :

1. Marketing Catalog (Qty Warehouse and this need update when have transaction on Catalog Order)

2. Catalog Order is Transaction Table, when quantity input it will be decrease quantity inventory on List 1 (Marketing Catalog)

List 1 (Marketing Catalog) and List 2 (Catalog Order) is connected with Lookup column IDCatalog

Can somebody help me for any ideas?

UpdateStock.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions

Does it run if you just fill in the blue sub() formula?

You can update the stock quantity by another flow, but this a bit tricky as Flow cannot retrieve items from the recycle bin. What you can do is:

 

- In Catalog Order list, you have to remove the user permission to delete items. Instead, create a boolean column like "Deleted" with default value = false.
- Then you can create a flow that triggers when an item is created or modified. As there is no trigger for just "When an item is modified", you have to lookup at first if the triggering item was modified (= Version > 1.0) or just created (Version No. = 1.0) in a condition. If it was modified, you can update your STOCK GUDANG by 
@add(outputs('Get_item')?['body/'STOCK GUDAND'],triggerOutputs()?['body/Qty'])  
and delete your triggering item at last.

View solution in original post

7 REPLIES 7
zaphod88
Responsive Resident
Responsive Resident

Consider the following:

Trigger: When an item is created (in Catalog Order list)
Get item > from Marketing POSM (ID: IDCatalog Id from Trigger)
Update item > STOCK GUDANG:

@Sub(outputs('Get_item')?['body/'STOCK GUDAND'],triggerOutputs()?['body/Qty'])  

There is an error when input expression, can you help for this?

 

Error message

 

Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The template action 'Update_item' at line '1' and column '1704' is not valid: "The template language function 'outputs' must have at least one parameter.".'.'.

 

 

 

Qty.jpg

There is an error

 

Lucas_Ignatius_0-1621237272988.png

 

Lucas_Ignatius
Helper IV
Helper IV

And now can be save and still error when running

 

Lucas_Ignatius_0-1621243972688.png

 

Seems like I did not get your column name correctly. So just try to update the field with the Get items - STOCK GUDANG value for test purposes. If you hover your mouse above it, you can see the right formula and insert it into the sub() formula:

zaphod88_0-1621360243280.png

 



I give my screen shoot detail about my column.

And if this can sub my STOCK, how can be STOCK will be back again if user want to cancel transaction?

Lucas_Ignatius_1-1621394344347.png

 

 

 

Lucas_Ignatius_0-1621392832729.png

Marketing Catalog Columns 

Lucas_Ignatius_1-1621392895969.png

 

 

Does it run if you just fill in the blue sub() formula?

You can update the stock quantity by another flow, but this a bit tricky as Flow cannot retrieve items from the recycle bin. What you can do is:

 

- In Catalog Order list, you have to remove the user permission to delete items. Instead, create a boolean column like "Deleted" with default value = false.
- Then you can create a flow that triggers when an item is created or modified. As there is no trigger for just "When an item is modified", you have to lookup at first if the triggering item was modified (= Version > 1.0) or just created (Version No. = 1.0) in a condition. If it was modified, you can update your STOCK GUDANG by 
@add(outputs('Get_item')?['body/'STOCK GUDAND'],triggerOutputs()?['body/Qty'])  
and delete your triggering item at last.

View solution in original post

I must have tried 2 - 3 times with same formula, because it can't save and can't work. 
But now it can work thanks for your help.

And for add stock, I'm very helpfully with your information "add(outputs('Get_item')?['body/'STOCK GUDAND'],triggerOutputs()?['body/Qty'])  "

Thanks again for your help.

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,986)