Dynamics-Crm-DevKit icon indicating copy to clipboard operation
Dynamics-Crm-DevKit copied to clipboard

Fix DeleteAsyncOperation flag always defaulting to true when false in database

Open Copilot opened this issue 2 months ago • 1 comments

The CommandAddCrmPluginRegistration command only added DeleteAsyncOperation = true when the database value was true, but omitted it when false. Since CrmPluginRegistrationAttribute.DeleteAsyncOperation defaults to true, plugins with asyncautodelete = false in the database incorrectly got DeleteAsyncOperation = true in generated code.

Changes

  • Always emit DeleteAsyncOperation with explicit boolean value from database
  • Extract asyncautodelete to variable for clarity
// Before: only added when true, otherwise relied on incorrect default
if (row.GetAttributeValue<bool>("asyncautodelete"))
    sb.Append(", DeleteAsyncOperation = true");

// After: always emit explicit value
var asyncautodelete = row.GetAttributeValue<bool>("asyncautodelete");
sb.Append($", DeleteAsyncOperation = {asyncautodelete.ToString().ToLower()}");

This aligns with how TaskServer.cs handles the flag (line 1440) and ensures generated plugin registration attributes accurately reflect CRM configuration.

Original prompt

this file https://github.com/phuocle/Dynamics-Crm-DevKit/blob/v4/v4%2FDynamicsCrm.DevKit%2FCommands%2FCommandAddCrmPluginRegistration.cs

is it check add DeleteAsyncOperation flag. if not pls fix and add


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Dec 18 '25 14:12 Copilot

@copilot continue improve check if class is plugin type custom action, custom api ? Is it add like plugin or workflow. You need double check TaskServer.cs for a lot of deployment task for: plugin, workflow, custom action, custom api, data provider to understand the idea that you can add CrmPluginRegistration attribute

phuocle avatar Dec 18 '25 14:12 phuocle