cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arindam40
Helper I
Helper I

Flow to save Message Center messages in SharePoint list is giving error on Duplicate messages

Hi Team,

I am trying to create a Flow to save Message Center messages in SharePoint list is giving error on Duplicate messages. I had this flow earlier which was fetching data from Office365 API's which is now deprecated, which is why I am building it from scratch using Graph API.

Three stages I have divided it:

Extracting Message center data from Graph API

Channel the data in right format from JSON to SharePoint list.

Make sure, no duplicate message keeps flooding the List.

 

The first two stages are all good. I can save messages in a SharePoint list. But then I noticed, if I leave it at that, there are lot of same duplicate messages updated with the same ID number.

That is when I tried to filter the messages from the existing SharePoint list & its failing ever since.

Earlier, when I used Office365 API's to get messages, I had the same issue, but setting SharePoint Column with Unique vales, helped me stop duplicate messages. The same formula somehow does not work this time.

The flow fails saying "An action failed. No dependent actions succeeded."

Meaning, because it cannot save Duplicate values in SharePoint it will not allow the rest of the flow to run. If i remove the condition of comparing & filtering duplicate values, then all data gets saved in list perfectly, with all sorts of Duplicates.

 

Here are some details:

Flow picture:

arindam40_1-1646079215603.png

 

The condition area with SharePoint item creation looks this way:

 

arindam40_3-1646079625750.png

In the body it says:

{
  "status"400,
  "message""The list item could not be added or updated because duplicate values were found in the following field(s) in the list: [Title].\r\nclientRequestId: ac822f12-45b8-489c-81ba-ee21a95b0f9b\r\nserviceRequestId: ac822f12-45b8-489c-81ba-ee21a95b0f9b"
}
In the SharePoint list, this is the Column which is holding unique values, which is compared with the new incoming ID values:
arindam40_4-1646079741248.png

 

Any help in the right direction would be great.

 

Thanks

Arindam

 

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @arindam40 :

I think you can add a condition to 'Apply to each 2' to determine if the Title already exists in the SharePoint List, update the record if it exists, and add a new record if it doesn't.
To determine whether this record exists, you only need to add a filter and then use length to determine whether the number of records in the return value of this filter is 0.

Best Regards,

Bof

arindam40
Helper I
Helper I

Hi,

I have changed the logic of my entire Flow. Here it is:

arindam40_0-1646597683476.png

The first Get Item is initializing the SharePoint list & then selecting Column 'Title' just to capture the Message numbers, that are already saved in the SharePoint list.

After that, I am calling Graph API, to collect all messages parsing JSON value & again selecting (Select 2) only the 'id' values from it.

I checked, both are holding data like this:

arindam40_1-1646597907666.png

Everything is ok till here.

Then I apply the first condition, for each output from Select 2, where I compare both outputs(Select 2 with Select 1) & if unique, not duplicate, then save it to the Array variable. Here is how it looks like:

arindam40_3-1646598120333.png

 

And this works, which will show data after I run it:

arindam40_2-1646598090495.png

 

Next, I am setting up the final condition, that if the API collected value contains the unique value collected in Stored data array variable, meaning, if both ID matches, then create a SharePoint item in the list provided, as shown:

arindam40_4-1646598473254.png

All is good.. The Flow completes successfully. But the Actual SharePoint list does not receive any new data. The list has data till 20th Feb. So I know there are new Unique items there, but its not creating items.

Any thoughts, where I am going wrong?

 

Thanks

Arindam

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,702)