Search code examples
sharepointpowerappspower-automate

update item in sharepoint List A depending on a result in List B


So I have 2 lists

1st list contains Materials, and each material got its own unique number (doesn't equal ID No. given by SP) and the Quantity of the material on hand.

The 2nd list contains a lookup column for the unique material number, and the user will type how much he/she withdraw from the material, just like a log.

So after a couple of hours searching, I could finally build a flow that will automatically calculate the difference between the Qty. On hand and the withdrawn Qty. using

triggerBody()?['Search_x0020_for_x0020_Q_x002e_C1']?['Value']

to "copy" the value of the lookup column as a number to another column in the same list so I can calculate the difference.

NOW I need to update the Qty. in the 1st list!

So I need a flow that will lookup for the unique material number and updates the material number.

at the same time, I'm afraid if it gets updated through this flow it'll be updated in the 2nd list which will create an infinite loop, because I've tried to create a flow that will update the amount and it resulted with a loop :(


Solution

  • Try using a new field as a flag to determine whether the update is made from the flow or not. Call the update action only if the update is not by a flow.

    Approach 1: You can create the a new field called 'FlowUpdateTime' update the field and 'Last Modified Date' field whenever you update List using flow.Then compare both before any update to understand whether the update is made by the flow or not.

    You can either use this approach or any other approach