4,0 Plug-In update dynamic entity

Jawab 4,0 Plug-In update dynamic entity

  • 20 Mei 2008 13:49
     
     

    Hi,

     

    I'm trying to set a value to the property "category" in the entity appointment using dynamicentity.

    CRM is giving me a cryptic error message (shown below) which isn't helpful. Any tips on going forward?

     

    Plug-In snippet:

    Code Snippet

    ICrmService service = (ICrmService)context.CreateCrmService(false);

    entity = (DynamicEntity)context.InputParameters.Properties["Target"];

    target.Entity.Properties["category"] = "value";

    TargetUpdateDynamic updateDynamic = new TargetUpdateDynamic();

    updateDynamic.Entity = entity;

    UpdateRequest update = new UpdateRequest();

     

    update.Target = updateDynamic;

    UpdateResponse updated = (UpdateResponse)service.Execute(update);

     

     

     

    Plug-In registration info:

    Message: book

    Entity: appointment

    Post stage

    Parent pipeline

     

     

    Error messages:

    SoapException: 5/20/2008 2:26:54 AM
    Error Message: 0x80040216 An unexpected error occurred. Platform

    Error Code: 0x80040216
    Error Description: An unexpected error occurred.
    Error Type: Platform

     

    Thanks,

    Nils

     

Semua Balasan

  • 21 Mei 2008 3:13
     
     
    Hi Nils,

    Post stage means after database transaction.

    try prestage(before database transaction)

    and you wont have to perform any special database requests, just add the properties you want to save and the system will do the rest, look in the sdk 4.0, pluginpreaccount sample

    Beachnerd
  • 22 Mei 2008 10:45
    Moderator
     
     

    stry prestage and see this article

     

    http://blogs.msdn.com/crm/archive/2008/05/21/plugins-which-message-and-which-pipeline.aspx

     

    Regards,

    Imran

     

     

  • 22 Mei 2008 11:31
     
     Jawab

     

    The solution was to register the plugin on the pre-event as mentioned above. And also to remove the update execution becuase it will otherwise create two updates; one when booking and one in the plugin.

     

    Thanks,

    Nils