# Power Platform Tidbits 9: Truncate a table in Dataverse with one command

Not that it cannot be done with one command, but I think it will look more readable in two. I'll let you do it in one as an exercise 😉

```powershell
$operation = @{
    Uri = "BulkDelete"
    Method = "POST"
    Value = @{
        QuerySet = @(@{
            EntityName="account"
            ColumnSet = @{ AllColumns = $true }
        })
        JobName = "Bulk delete all rows from account table"
        SendEmailNotification = $false
        ToRecipients = @(@{
            activitypartyid = "00000000-0000-0000-0000-000000000000"
            "@odata.type" = "Microsoft.Dynamics.CRM.activityparty"
        })
        CCRecipients = @(@{
            activitypartyid = "00000000-0000-0000-0000-000000000000"
            "@odata.type" = "Microsoft.Dynamics.CRM.activityparty"
        })
        RecurrencePattern = ""
        StartDateTime = Get-Date
        RunNow = $false
    }
} | ConvertTo-Json -Depth 4
Send-DataverseOperation -InputJson $operation
```

Now, let's break it down. The first line of the script is actually building a Hashtable and converts it to JSON. You can write it as JSON in the first place if you prefer. I did it with a Hashtable, because in real-world PowerShell scripts you are usually dealing with Hashtables.

Note that you should be already connected to Dataverse using 'Connect-Dataverse' before running the above commands. Send-DataverseOperation is part of PSDataverse module. To know more, I suggest you read about it [here](https://github.com/rezanid/PSDataverse).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.bycode.dev/power-platform-tidbits-9-truncate-a-table-in-dataverse-with-one-command.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
