cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Flow to update Inventory List when Ledger Transaction added

Hey everyone,

I'm working on an inventory control system for my nonprofit, and I've run into a snag.  I built two lists, 'Warehouse Inventory Control List' and 'Warehouse Inventory Transaction Ledger'.  I created a PowerApp that can create new items for the Inventory list, and create ledger entries when items are removed from the warehouse.

The problem I've run into is that I want to ensure the inventory update (i.e. changes to the WICL) applies from the Transaction Ledger list trigger, rather than the PowerApp.  The reason for this is I also want to update the Inventory list if entries are modified or deleted, which would be done through SharePoint directly by an admin.

In my Flow, I have the following steps:

1. Trigger occurs - New item added to Transaction Ledger.

2. Get Item - Retrieves the Item from the Inventory list corresponding to the Transaction Ledger (works).

3. Subtract Quantity taken from Quantity on Hand - Doesn't work.

                    - I have tried two methods for this step.  First, I created Integer variables from each list's quantity value, then tried to add them together.  I was told the integers weren't valid integers.  Then, I tried to use Compose to create an output from the two quantity values - the Integers are being pulled into Power Automate as Floats, and sub() won't work.

4. Add Quantity Taken to Quantity Used to Date - Same problem as #3, only with add() this time.

5. Update item - this should work if I can get variables into the fields I need them.  I wish I could just add two values in the field and be done with it.

 

I can provide more info tomorrow if necessary, and I appreciate any help in advance.  I feel like I'm losing my mind trying to convert floats to ints.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Flow to update Inventory List when Ledger Transaction added

Hi @ParkCenterDev 

 

Can you show me the Power Automate itself and the error. It's easier to check it that way.

 

Have you tried the int function?

int(<variable>)

 

It needs to be a string but you can get one easily with the string function.

int(string(<Variable>))

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

4 REPLIES 4
Highlighted
Super User II
Super User II

Re: Flow to update Inventory List when Ledger Transaction added

Hi @ParkCenterDev 

 

Can you show me the Power Automate itself and the error. It's easier to check it that way.

 

Have you tried the int function?

int(<variable>)

 

It needs to be a string but you can get one easily with the string function.

int(string(<Variable>))

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Highlighted
Regular Visitor

Re: Flow to update Inventory List when Ledger Transaction added

ParkCenterDev_0-1597425229618.pngParkCenterDev_1-1597425241986.png

Above are the lists in SharePoint.  With a compose action, I have attempted the following three methods:

sub(item()?['Quantity On Hand'],triggerBody()?['Quantity'])

        - this returns an error because both values are Floats.

sub(int(item()?['Quantity On Hand']),int(triggerBody()?['Quantity']))

        - Also returns an error - The value cannot be converted to the target type.

sub(int(string(item()?['Quantity On Hand'])),int(string(triggerBody()?['Quantity'])))

      - Same error as above.

 

 

Highlighted
Regular Visitor

Re: Flow to update Inventory List when Ledger Transaction added

ParkCenterDev_0-1597425534395.png

 

Highlighted
Regular Visitor

Re: Flow to update Inventory List when Ledger Transaction added

So I ended up taking a few days to think about things and realized you had given me the solution, I just needed to rearrange things first.  Thank you!

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (6,732)