Search code examples
c#dynamics-crm

Custom fields on deactivate button for a custom entity


So I have a custom entity called "Projects" - when a user attempts to deactivate a project, there is a plugin which checks if there are any child projects or tasks related. If there are, it will throw an exception.

This lead me to two questions:

  1. Can I customise the deactivate dialog with a custom field? Currently it gives the option to select Resolved/Cancelled, but can I add another field which is required? In my searches I couldn't find any way to do this outside of Opportunity and Case.

  2. If question 1, is "It's not possible". I have tried another solution which is with a Custom page which has the fields and opens using a custom button. However, when the fields have been completed and submitted, it doesn't show the plugin error message, instead just returning to the page with no message and the project unresolved.

Any advice would be appreciated!


Solution

  • You cannot customise the OOTB deactivate dialog to capture additional information. However what you could do would be something like:

    1. Modify Ribbon to Remove Deactivate button

    2. Add 'Custom' Deactivate button

    3. On custom deactivate button:

      a. Display dialog

      b. Execute custom action (or similar)

    4. Let the custom action updated the entity with you additional data and then deactivate the record