locked
CRM 2011 RRS feed

  • Question

  • Hello All,

    I want to write plugins which will call while assigning lead to other user, that time i want lead id if assigned lead and then i will check in contact for that lead.So i can change owner of that contacts accordingly.

    Please suggest some answer.

    Thanks

    Abhijeet

    Friday, March 14, 2014 10:57 AM

All replies

  • Register a plugin on the Update message in the Pre stage.

    This way you'll have only the updated values. Check if the owner is among them (that will mean the lead has been assigned during the last update).

    Then retrieve the contact field of the entity from the database (you will need to get another copy of the entity, since this field won't always be included in the plugin context).

    Then retrieve the Contact from the ID and make an assign request to change the owner.

    If you need to assign the contact to the same user that is the owner of the lead it is much easier to change the relationship between Lead and Contact to Cascade for ownership.

    • Proposed as answer by Pierobond1 Wednesday, March 26, 2014 9:30 AM
    Saturday, March 15, 2014 10:18 AM