Create Item in Child SharePoint list if does not exist or Update an existing item in a child sharepoint list from a master sharepoint list - Power Automate

I have two lists-

Master and the Child list
I am using the Master List's ID column and I created an integer column in the Child List called "CaseID". CaseID is my Key Column.

Here is the Flow.

Trigger-

Add Step "Get Items" (Child List that will be updated)

In advance options in the Filter Query enter the following snip

ChildList-Column eq 'MasterList Column'

In my case:

Your Master List Column should be able to be added from the Dynamic Content from the "When an item is created or modified" section.

Add a condition

Write the expression for the first data comparison field.

length(outputs('Get_items')?['body/value'])  is not equal to 0

 

IF YES
Update an item

"Value" in the Apply to each comes from your "Get Items" section in the Dynamic Content.

The Values for your "Update Item" should come from the "When an item is created or modified" section in the Dynamic Content.

IF No

Create new item (This is where the CaseID is created with the unique ID)

The Values for your "Create Item" should come from the "When an item is created or modified" section in the Dynamic Content.

That's it.