Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Help - Duplicating Items in a dataverse table

(1) ShareShare
ReportReport
Posted on by
Hi, 
 
I have a flow that runs daily for data that is within SharePoint. It initializes a variable for the Status > Gets all items from the Sharepoint List > Lists all the current rows from the dataverse table > Then initializes a variable for a Invoice Number
 
Then it a condition to check is the status in the list is the same as the variable and if the item in the sharepoint list is older or equal to 60 days ago (this condition check works) 
 
Then if both those checks are correct, it should check to see if the item is currently in the dataverse table or not, but at the moment it is not working, it is just duplicating all items in the table and keeps adding them.
 
In the condition, I am checking to see if the invoice number from the dataverse table is the same as the number in the sharepoint list, if it isn't the same it shouldnt add it into the the table but it is.
 
 
How do I compare both lists and only add in items that arent in the dataverse list? 
 
I can provide more information if needed.
  • CU23071121-0 Profile Picture
    CU23071121-0 on at
    Help - Duplicating Items in a dataverse table
     
    I keep getting this error on the first Filter Array
  • Suggested answer
    Ninjasabi Profile Picture
    Ninjasabi 120 on at
    Help - Duplicating Items in a dataverse table
    - trigger: Recurrence
      inputs:
        frequency: Day
        interval: 1
     
    - action: Initialize variable
      inputs:
        name: varStatus
        type: String
        value: "YourStatus"
     
    - action: Get items
      inputs:
        siteAddress: "YourSharePointSite"
        listName: "YourSharePointList"
     
    - action: List rows
      inputs:
        tableName: "YourDataverseTable"
     
    - action: Filter array
      inputs:
        from: "@outputs('Get_items')?['body/value']"
        where: "and(equals(item()?['Status'], variables('varStatus')), lessOrEquals(item()?['Created'], addDays(utcNow(), -60)))"
     
    - action: Apply to each
      inputs:
        items: "@outputs('Filter_array')"
      actions:

        - action: Filter array
          inputs:
            from: "@outputs('List_rows')?['body/value']"
            where: "equals(item()?['InvoiceNumber'], items('Apply_to_each')?['InvoiceNumber'])"
     
        - action: Condition
          inputs:
            condition: "@equals(length(outputs('Filter_array')), 0)"
          ifTrue:
            actions:

              - action: Add a new row
                inputs:
                  tableName: "YourDataverseTable"
                  data: {
                    "InvoiceNumber": "@items('Apply_to_each')?['InvoiceNumber']",
                    // Add other fields as needed
                  }
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard