locked
how to deactivate subgrid on deactivating main record ? RRS feed

  • Question

  • Hi All,

    I am using online CRM 2011. If i deactivate a record , the record in child entity (in subgrid) should also get deactivate. How to do this?

    I have used two custom entity. I have created 1:N relationship between two. One i am using as a main form and second one i am using it as a subgrid inside the main form. If i deactivate the main record, the record in the subgrid should also get deactivate- which is not happening . How to do this?   

    Regards 

    Shankar

    Monday, January 21, 2013 11:50 AM

Answers

  • You may create an asynchronous  plug-in on the statecode changes and see if the changes goes from active into inactive than you create a query to get all the active records from the child entity linked to the current record and deactivate them.

    I hope this helps.

    Zoran

    • Marked as answer by Shank Bala Wednesday, January 23, 2013 6:07 AM
    Monday, January 21, 2013 1:06 PM

All replies

  • You may create an asynchronous  plug-in on the statecode changes and see if the changes goes from active into inactive than you create a query to get all the active records from the child entity linked to the current record and deactivate them.

    I hope this helps.

    Zoran

    • Marked as answer by Shank Bala Wednesday, January 23, 2013 6:07 AM
    Monday, January 21, 2013 1:06 PM
  • Hi,

    In the OOB customizations it isn't possible to cascade the statecode by the relationship.

    So have the only possibility to do this manually by:

    1. Javascript in the onSave event
    2. C# in a plugin (like Zoran already mentioned)
    3. C# in a custom workflow-step

    You can find examples here: http://mileyja.blogspot.co.at/2011/07/set-status-or-state-of-record-using.html

    Best regards,

    Andreas


    Andreas Buchinger
    Microsoft Dynamics Certified Technology Specialist
    MCPD: SharePoint Developer 2010

    Monday, January 21, 2013 2:45 PM