locked
merging plug-ins on same entity RRS feed

  • Question

  • Hi All,

    I need to write some code to do the following two things on SalesOrder entity

    1) On Creation(one time only) -  Do some maths and populate some custom attributes based upon information provided by user

    2) On Update( Every Save event) - Check if some certain fields being updated, update all the order items with those values.

     

    I have written a Plug-in  which triggers upon "Create" Message and its working fine.

    I have written the second plug-in which triggers upon "Update" Message which is not working and giving me the error

    "The given key was not present in the dictionary"

    When I looked into the trace, I believe that its not getting the "id" property from the OutPutParameters prpoerty bag.

    string orderid = context.OutputParameters.Promoerties["id"].toString();

     

    I believe its because the update is get called (service.Update(entity) in 1st stage within the Plug-in (Create Message) and its not forwarding the "id" property OR  because the "id" property has not been changed so its not in the Propertybag.

    How can I get the "id" ("salesorderid") property value in the Update Plug-in code?

     

    My question is what's the best way to write something against these events (Create, Update) and can we merge it into single code or not.

     

    Thanks in advance


    AM
    Tuesday, November 30, 2010 2:36 PM

Answers

All replies