locked
CRM 4.0 - Deleting Custom Entity Records when a related Record is deActivated RRS feed

  • Question

  • Hi to All CRM Experts out there,

         I have 2 Custom Entities A and B. What I want to do is when I deActivate any of the A Record, related B records for A should get deleted.

    I tried to do it via WorkFlow but does not seem to work.

    How should I go for it?

    Can PlugIns help me?

     

    Thursday, December 11, 2008 9:36 AM

Answers

  • Hi Abbas, You cannot do this by simple workflow. Possible solutions below: 1- Create a Plug-in that deletes/Deactivates the associated entity on Delete/Deactivate of the parent entity. OR 2- Create a workflow that calls an Assembly that deletes/Deactivates the associated entity on Delete/Deactivate of the parent entity. OR 3- Write JavaScript that uses Ajax and MSCRM Web service to Fetch associated records and then Delete/Deactivate records. 4- Create a custom web service that take the GUID of the record and deactivates/deletes the associated records. Call the web service from your Page/button in ISV.config. Where can you get help to do the above? 1- Read the MS CRM SDK. 2- Google MS CRM blogs.


    Hassan.
    Thursday, December 11, 2008 10:00 AM

All replies

  • Hi Abbas, You cannot do this by simple workflow. Possible solutions below: 1- Create a Plug-in that deletes/Deactivates the associated entity on Delete/Deactivate of the parent entity. OR 2- Create a workflow that calls an Assembly that deletes/Deactivates the associated entity on Delete/Deactivate of the parent entity. OR 3- Write JavaScript that uses Ajax and MSCRM Web service to Fetch associated records and then Delete/Deactivate records. 4- Create a custom web service that take the GUID of the record and deactivates/deletes the associated records. Call the web service from your Page/button in ISV.config. Where can you get help to do the above? 1- Read the MS CRM SDK. 2- Google MS CRM blogs.


    Hassan.
    Thursday, December 11, 2008 10:00 AM
  • Hi ,

    I am facing a similar kind of problem.

    I have registered a plugin to fire when the state of a custom entity record changes i.e. "Is Activated" or "Is DeActivated".

    I am unable to have my plgin code fired when I changed the status of the custom entity record to"Active" or "InActive" via the UI from them Actions Menu in toolbar.

    The "context.MessageName" value passed in the Plugin is "Update" while I have registered the Plugin to fire on "SetState" and "setStateDynamicEntity" for that particular entity.

    Please help me as to how I can make my plugin fire for the "State change" event.

    Regards


    Susan
    Monday, February 23, 2009 6:37 AM