Search code examples
office365power-automate

Power Autotmate - Flow works it reads all the the data from the SQL database, but does not create the newest item in SP list


My flow goes like this: Manually trigger -> Get rows(SQL database) -> Apply to Each wrapper -> Get items(SP) -> Condition length(body('Get_items')?['value']) is equal to 0 -> if true -> Create item(SP) -> if false -> nothing

enter image description here

The Flow is not creating the lates entry from my SQL database

It's getting data from an SQL database, and i want to check if the data is matching the items in my SP list.

i played around with the condition and i when i do it like: length(body('Get_items')?['value']) is not equal to 1 then the flow never stops, which makes sense but i get my test entry into my SP List.

I hope someone has time to help.

SOLUTION UPDATE:

Here is the raw inputs coming from the database, the one with ID 52 is my test entry

It returns "True" in the condition so the action to create item is "skipped" If i then move the action under the "True" statement instead, that's when my test item is created, but it also creates an infinite loop, where it keeps creating items (duplicating) untill i manually stop it.

UPDATE: Flow looks like this now

Using this expression on condition length(body('Get_items')?['value']) is greater or equal to 1


Solution

  • The solution was

    That i had to add a Filter Query to my "Get items", so that the flow checks if there is a value in my SP list with the value from my database Get items Filter Query

    Together with the Condition length(outputs('Get_items')?['body/value']) is greater or equal to 1

    The flow works as intended, it now ony creates the latest entry from my database