Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

BulkDelete action in Dataverse

Posted on by 22

Hello!

We have an annual data clean-up wherein we need to delete Contact records that doesn't have any Case associated to it. I couldn't find a reference of query set syntax with related entity used as a filter condition. Would you please help translate below FetchXML query to a QuerySet that is used in PowerAutomate? Thank you!


pastedimage1669302081553v3.png

pastedimage1669302116664v4.png
  • Suggested answer
    Susie Z Profile Picture
    Susie Z on at
    BulkDelete action in Dataverse
    Hi Jean,
     
    A bit late for a response, I hope your query was solved!
     
    For reference, the syntax below works for related entities in the Power Automate unbound action. 
     
    [
       {
          "EntityName":"<sourceentity_schemaname>",
          "LinkEntities":[
             {
                "LinkFromEntityName":"<sourceentity_schemaname>",
                "LinkFromAttributeName":"<sourceentity_column_schemaname>",
                "LinkToEntityName":"<relatedentity_schemaname>",
                "LinkToAttributeName":"<relatedentity_column_schemaname>",
                "JoinOperator":"Inner",
                "LinkCriteria":{
                   "Conditions":[
                      {
                         "AttributeName":"<column_schemaname>",
                         "Operator":"Equal",
                         "Values":[
                            {
                               "Value":"<value>",
                               "Type":"System.String"
                            }
                         ]
                      }
                   ]
                }
             }
          ]
       }
    ]
     
    References:
  • Jean M. Profile Picture
    Jean M. 22 on at
    RE: BulkDelete action in Dataverse

    Hello Steve Zhao2 , thank you for your help. I've checked the link provided but it doesn't contain syntax for link-entity. Would you know any other reference that we could use? Also, I tried to pattern the syntax for link-entity condition but it doesn't work.

    pastedimage1669961604334v2.png

  • Suggested answer
    Albion Ferracaku Profile Picture
    Albion Ferracaku 20 on at
    RE: BulkDelete action in Dataverse

    Hello,

    According to your query, field "..caller" of "contact" should be null. So selecting field "..caller" in "Fields" section and choosing "Does Not Contain Data" should be enough.

    Screenshot_5F00_10.pngScreenshot_5F00_11.png_2D00_640x480.png

    (in my case: "Account" is a lookup field that points to Account entity)

  • Suggested answer
    Steve Zhao2 Profile Picture
    Steve Zhao2 on at
    RE: BulkDelete action in Dataverse

    Hi Jean M,

    There is a tool named FetchXML builder which can convert fetchxml to Query Expression in the Xrm Toolbox.

    However, it isn't the format of QuerySet in the Bulk Delete action and you need manually build it.

    pastedimage1669360360166v1.png

    About the format, you can refer to this link:

    Solved: Dataverse - Perform an unbound action - Bulk Delet... - Power Platform Community (microsoft.com)

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,958 Super User on at
    RE: BulkDelete action in Dataverse

    Hi,

    Create rollup field on consumer entity of type whole number to store the count of case file records.

    learn.microsoft.com/.../define-rollup-fields

    Now use this field in your filter criteria

    if yourrollupfield value ==0 Delete

  • Jean M. Profile Picture
    Jean M. 22 on at
    RE: BulkDelete action in Dataverse

    Hello Bipin Kumar, thank you for your response. Unfortunately, does not contain condition (for related entity) is not available as operator in Bulk delete. Would you know if there is a workaround for this one? Our goal is to delete consumer (contact) records that doesn't have any case(file) associated to it.
    pastedimage1669329772344v2.png

    Here's the condition used in the view.
    pastedimage1669329439064v1.png

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,958 Super User on at
    RE: BulkDelete action in Dataverse

    Hi,

    Can you not setup oob bulk delete jobs to cleanup your records?

    learn.microsoft.com/.../delete-bulk-records

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,835 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,526 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans