locked
how to find that closed opportunity is reopened?? RRS feed

  • Question

  • hello all,

    i want to delete one of my custom entity record when closed opportunity is reopened.

    and this custom entity has N:1 relationship with opportunity.

    how can i do that??


    Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad


    Tuesday, August 14, 2012 1:07 PM

Answers

All replies

  • You need to create a plugin as you can't delete the entity in a workflow.

    Create a plugin on setstate and setstatedynamicentiy and delete the custom entity. 

    Here is sample code on how to write a plugin on above mentioned plugin messages

    http://thomasthankachan.wordpress.com/2011/10/06/plugin-usage-of-setstate-and-statestatedynamicentity-message/

    I hope this helps.


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com


    Tuesday, August 14, 2012 2:09 PM
  • hi amreek 

    thanks for reply

    but how can i find out that closed opportunity is Reopened.???


    Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad

    Tuesday, August 14, 2012 2:30 PM
  • The funny thing is that these messages will trigger only when you reopen a closed opportunity.

    When you close the opportunity as won or lost it does not trigger setstate messages. It will trigger Win or Lose message.

    I hope this helps.


    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior CRM Consultant CDC Praxa Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com

    • Proposed as answer by Amreek Singh Tuesday, August 14, 2012 2:41 PM
    Tuesday, August 14, 2012 2:40 PM
  • You can also accomplish this by default functionality using workflows and an extra 1:m relationship.

    You say you have a m:1 relationship from custom entity to opportunity.

    • Create a new 1:m relationship from Custom entity to opportunity (turn the relationship around)
    • When you close the opportunity, you create the record in the custom entity (I presume). In this workflow, just fill out the "target record into the lookup on the opportunity that is created.
    • Then create a workflow that runs on update status on opportunity where the lookup contains data......
    • Set the parent record to inactive and remove the lookup on the opportunity AND on the custom entity.
    • Then create a bulk deletion job that deletes all records in the custom entity that has no parent opportunity.

    This should take no more than 15-20 mins to implement.


    Rune Daub Senior Consultant - Dynateam CRM http://www.xrmmanagement.com

    • Proposed as answer by RuneDaub Tuesday, August 14, 2012 6:09 PM
    Tuesday, August 14, 2012 6:09 PM
  • Hi Rune

    Thanks for reply

    but what if one of opportunity have more than one custom entity in their relation.??


    Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad


    Thursday, August 16, 2012 7:04 AM
  • hi Amreek

    sorry, My bad.

    it's worked.


    Kartik Ghodasara Associative Software engineer, Synoverge Tech Pvt. Ltd. Ahmedabad

    Thursday, August 16, 2012 8:48 AM