MS CRM 4.0 => Plugin - Assign Message, problem while editing multiple records RRS feed

  • Question

  • In MS CRM 4.0 I need to record changes in owner field. If user assigns record (e.g. an account) to another CRM user, I need to save the information about this change (who was the previuos as well who is the new owner).

    I registered a plugin in the Post Stage with two images (PRE and POST). The plugin works well, but only if user modifies one record at once. If he selects multiple accounts in the account overview and sets the same owner for each of the selected record, the plugin works only for the first selected record. For this record I'm getting in the PRE-Image information about previuos owner, in the POST-Image I see the new owner, as expected. However, as the plugin runs for the second time, for the next selected record, the PRE-Image as also the POST-Image consist already the new assigned owner, instead of the old one.  At this stage the information about old owner isn't available anymore...I tried to register the plugin in the PRE-Stage, but I'm getting the same faulty information.

    Do you have any suggestions, how to avoid this problem?

    Monday, November 21, 2011 8:23 PM


All replies

  • Hello,

    Try to use information from context instead of image like:

    Guid newownerid = ((SecurityPrincipal)context.InputParameters("Assignee")).PrincipalId;

    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    Monday, November 21, 2011 9:23 PM
  • Hi,

    thanks for your answer!

    Currently I'm getting information about new owner. The problem is, that I'm not getting the old owner, but only if I assign a new owner to multiple records at once. The problem is, that MS CRM changes owner for all of them at once. Here is the flow:

    1. user selects multiple account and clicks assign to new owner

    2. my plugin is called for the first record. In the PRE-Image I find the old owner and in the POST-Image I find the new owner. That is correct.

    3. the plugin is called for the second time, for the next record. The Pre-Image as well the Post-Image contains the same new owner, what is faulty. Here, I'm sure, that the old owner wasn't the same as the new owner.


    Most likely MS CRM updates all records at once and these update takes place while the first record is being updated.

    So, the question is, how can I get the old owner for each newly assigned record?


    Tuesday, November 22, 2011 8:48 AM
  • Anyone?
    Thursday, November 24, 2011 12:30 PM
  • Have you tried to register your plugin in child pipeline?
    Microsoft CRM Freelancer

    My blog (english)
    Мой блог (русскоязычный)
    Follow Andriy on Twitter
    • Marked as answer by wasserfrau Monday, November 28, 2011 1:36 PM
    Thursday, November 24, 2011 1:28 PM
  • Hallo,

    great. That is the solution to my problem. I registered my Plugin with the message Update in a child pipeline and now I'm getting both the old owner and the new one.

    Thank you!





    Monday, November 28, 2011 1:36 PM
  • For some reason the outlook plugin tries to deactivate an userquery. Any idea, why?


    Thanks in advance!





    Thursday, December 15, 2011 8:20 AM