locked
PlugIn to fire if I update a record on 1:N related entity RRS feed

  • Question

  • I have a custom Entity1 and Entity2 and Entity3

    1-N Entity1 and Entity2

    1-N Entity1 and Entity 3

    Requirement: the Event has to fire If I update a record in Entity 3 then Entity2's record should be updated.

    please let me know how to register my PlugIn to fire on each 1:N entities.


    Thanks, - Israel Pradeep, - Software Engineer & PMP & B.I - Entrepreneur, - "If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"".
    Friday, June 3, 2011 12:24 AM

Answers

  • Hi Israel,

     

    If I understand correctly, both entity3 and entity2 have a lookup to entity1, and so if you update entity3 then all the entities2 that are associated with the same entity1 as the entity3 that you updated must be updated? Is that correct?

     

    Also, when you say " If I update a record in Entity 3" do you mean update any attribute or sepcifically reparent it to another entity 1?

     

    If so, you will need to register a step on entity3 update and then in your plugin you should retrieve all the entities2 that are associated to the same entity1 and update them, does that make sense?


    Gonzalo | gonzaloruizcrm.blogspot.com


    Friday, June 3, 2011 12:46 AM
    Moderator
  • I cannot tell you if it has to be sync or async and whether it needs to be pre or post- operation, it really depends on your requirements so you have to analyze which option you need ;-)

     

    You are right, if you want your plugin to trigger whenever entity 1,2 or 3 is updated then you need 3 steps. However, be careful with creating infinite loops. If inside your plugin you modify entiti 1/2/3 then your plugin will trigger the pluggin and will cause an infinite loop which will be aborted by the system.


    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, June 6, 2011 3:58 PM
    Moderator

All replies

  • Hi Israel,

     

    If I understand correctly, both entity3 and entity2 have a lookup to entity1, and so if you update entity3 then all the entities2 that are associated with the same entity1 as the entity3 that you updated must be updated? Is that correct?

     

    Also, when you say " If I update a record in Entity 3" do you mean update any attribute or sepcifically reparent it to another entity 1?

     

    If so, you will need to register a step on entity3 update and then in your plugin you should retrieve all the entities2 that are associated to the same entity1 and update them, does that make sense?


    Gonzalo | gonzaloruizcrm.blogspot.com


    Friday, June 3, 2011 12:46 AM
    Moderator
  • perfect understanding, as you said: "If so, you will need to register a step on entity3 update and then in your plugin you should retrieve all the entities2 that are associated to the same entity1 and update them" 1st. I have registered the plugIn on entity3 update. 2nd. In code I have called the update methods for entity3 in my code. ***3rd. If click Save or Save/Close in the entity 1/2/3, then automatically the PlugIn should call. Here I'm stuck in step3, how to register my plugIn to automatically fire when the updates has takes place in Entity 1/2/3. Thanks In Advance. Thanks, - Israel Pradeep, - Software Engineer & PMP & B.I - Entrepreneur, - "If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"".
    Monday, June 6, 2011 3:32 PM
  • Hi Israel,

     

    I don't understand your question. You say it must trigger when entity 3 is updated, but then you say:how to register my plugIn to automatically fire when the updates has takes place in Entity 1/2/3.

    Do you want it to trigger whenever entity 1, 2 OR 3 is updated? If so, you need to register 3 separate steps.

     


    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, June 6, 2011 3:41 PM
    Moderator
  • Yes, thanks for your quick reply.

    I want to fire this plugIn when Entity 1/2/3 is updated.

    to register 3 seperate steps:

    1st. registration on Entity 2 for Update/Post/Synchronous, should I register image too???

    and the same thing for Entity 3 and 1 right? or should I add this to Child Pipeline instead of Parent.

    Please correct me If Im wrong.


    Thanks, - Israel Pradeep, - Software Engineer & PMP & B.I - Entrepreneur, - "If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"".
    Monday, June 6, 2011 3:54 PM
  • I cannot tell you if it has to be sync or async and whether it needs to be pre or post- operation, it really depends on your requirements so you have to analyze which option you need ;-)

     

    You are right, if you want your plugin to trigger whenever entity 1,2 or 3 is updated then you need 3 steps. However, be careful with creating infinite loops. If inside your plugin you modify entiti 1/2/3 then your plugin will trigger the pluggin and will cause an infinite loop which will be aborted by the system.


    Gonzalo | gonzaloruizcrm.blogspot.com

    Monday, June 6, 2011 3:58 PM
    Moderator
  • Great Suggestion Gonzalo, Thanks.

    to see the updated values, the Parent form is not refreshing, is there any way to refresh the associated form to see the updated values.??


    Thanks, - Israel Pradeep, - Software Engineer & PMP & B.I - Entrepreneur, - "If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful""

    Monday, June 6, 2011 4:05 PM