cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ömer
Resolver I
Resolver I

Power Automate Workflow

Hello together

I am working on a workflow that should have the following function. My workflow should check if an ID already exists as a sharepoint entry. If it exists, then it should overwrite it please. If not it should create a new one.

However, I have the problem that it checks every entry and then simply creates all entries twice. Attached are the images (with german headline)

 

mer_0-1660553723438.png

In my test I wanted to check if the ID 15.11.2030 already exists and if so overwrite it but it created a new entry and duplicated the other entries too

 

For my power app, here's how I thought about it:

 

mer_1-1660553819973.png

I wanted to address the ID field directly. Then I wanted to create a variable with the value of the ID field

 

mer_2-1660554009641.png

Then I call my elements off I would not know now what I could write here still purely.

 

There is also the selection retrieve element but here I would need an ID and this I would have to write with a f(x) there I would not know what must purely there, therefore I have not used it.

 

mer_3-1660554146838.png

 

After the Get Items command I check if my PowerApp ID is the same as an ID in my sharepoint if so it should take the left path and update it. If no create a new entry.

But it only creates new items and I would need help here very urgently.

 

mer_4-1660554279380.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

Hi @Ömer,

 

In the "Get Items" action, add a filter:

 

 

Title eq '@{triggerBody()['ID-Field']}'

 

 

This will retrieve the item with the matching ID-Field value if it exists.

 

The condition after this will have to be changed to:

 

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

 

In the Yes field, add the "Create item" action and in the No field, add the "Update Item" action.

 

You may have to make some changes to the above to adjust for German language/locale.

 

Edit: The "Update Item" action will be wrapped in an "Apply to each" loop automatically when selecting the value for Id from the Dynamic content. You can either ignore that or instead of selecting the Dynamic content, use the below:

 

 @{First(outputs('Get_items')?['body/value']?['ID'])}


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

2 REPLIES 2
BCBuizer
Super User
Super User

Hi @Ömer,

 

In the "Get Items" action, add a filter:

 

 

Title eq '@{triggerBody()['ID-Field']}'

 

 

This will retrieve the item with the matching ID-Field value if it exists.

 

The condition after this will have to be changed to:

 

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

 

In the Yes field, add the "Create item" action and in the No field, add the "Update Item" action.

 

You may have to make some changes to the above to adjust for German language/locale.

 

Edit: The "Update Item" action will be wrapped in an "Apply to each" loop automatically when selecting the value for Id from the Dynamic content. You can either ignore that or instead of selecting the Dynamic content, use the below:

 

 @{First(outputs('Get_items')?['body/value']?['ID'])}


Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.
Ömer
Resolver I
Resolver I

Worked Thank you 

 

i have tested it with two other sharepoint elements no duplicates it changes the right one 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Kudoed Authors
Users online (2,420)