Search code examples
dynamics-crmdynamics-crm-2011

Could not register pre-delete validatation plugin step for the Team entity in MS Dynamics CRM 2011


I want to add validation before Team entity deletion. In order to do that, I need to add Pre-validation plugin step for the Delete message and Team entity.

Nevertheless, when I'm trying to do it via the Plugin Registration Tool, I'm getting an error:

Invalid Entity Name

Invalid Primary Entity or Secondary Entity specified. Please re-enter the data.

Here is the data I'm filling in the Register New Step:

  • Message: Delete
  • Primary Entity: team
  • Secondary Entity: none
  • Run in User's Context: Calling User
  • Execution Order: 1
  • Eventing Pipeline Stage of Execution: Pre-validation
  • Execution Mode: Synchronous
  • Deployment: Server

I'm using Microsoft Dynamics CRM 2011.

I could not find any explanation for that. What I'm asking is:

  1. What is the reason for that?
  2. What is the intended way of applying custom validations during the deletion of the Team entity?

Solution

  • It is possible to enable registering the plug-in by updating the corresponding SdkMessageFilterBase record.

    1. Connect to your DB server.
    2. Navigate to your %ORGANIZATION_NAME%_MSCRM DB.
    3. Run the script:
      SELECT
          [dbo].[SdkMessageFilterBase].[PrimaryObjectTypeCode],
          [dbo].[SdkMessageFilterBase].[CustomizationLevel],
          [dbo].[SdkMessageFilterBase].[SecondaryObjectTypeCode],
          [dbo].[SdkMessageFilterBase].[IsCustomProcessingStepAllowed],
          [dbo].[SdkMessageFilterBase].[Availability],
          [dbo].[SdkMessageFilterBase].[SdkMessageId],
          [dbo].[SdkMessageFilterBase].[IsVisible]
      FROM
          [dbo].[SdkMessageFilterBase]
          INNER JOIN [dbo].[SdkMessageBase]
              ON [dbo].[SdkMessageFilterBase].[SdkMessageId] = [dbo].[SdkMessageBase].[SdkMessageId]
      WHERE
          [dbo].[SdkMessageBase].[Name] = 'Delete' AND
          [dbo].[SdkMessageFilterBase].[PrimaryObjectTypeCode] = 9 -- Team entity code is 9
    
    1. Check the result. If IsCustomProcessingStepAllowed field is set to 0, it is preventing you from registering the plug-in step.
    2. Update IsCustomProcessingStepAllowed to 1 to be able to register custom plug-in step.

    This solution worked for me.

    Articles describing such solution: