locked
Plugin Execute sequence? RRS feed

  • Question

  • I created a plugin to run on post-create message and am able to get the "id" from the context.OutputParameters Properties bag.  While stepping through my plugin, I run an sql query on my CRM SQL database to check if the "id" that I grabbed has been created and it does not exist.  It appears to me that the actual CRM query to insert my new incident case does not actually run until my plugin has completed, because I can query the data base again with the "id" that I grabbed and the row now exists (after my plugin runs).

     

    However, the data that my plugin created for custom attributes of my incident entity is not there, so I have to put in my code to run an Update on the DynamicEntity of my incident to actually be able to query it, but this actually is hitting SQL twice, I believe, first to Create the new incident case and then again to update the custom attributes.

     

    If this Execute/Create sequence is true, I wish to not have CRM 4.0 hit the database twice.  Is there some way I can put my custom attirbute values in the context Properties bag to have it inserted the first time without a run call to SQL for the update?

    Thursday, March 27, 2008 11:50 PM

Answers

  • If you want to have the database hit only once, then I'd use a pre-create, not a post-create, and update the Target parameter within InputParameters

     

    Friday, March 28, 2008 9:50 AM
    Moderator