locked
Task and Phone Activity Created through the Social Pane CRM 2013 RRS feed

  • Question

  • Hi there,

    I have a plugin customization that updates the organization field on the activity
    entity if the Regarding field has a parent organization. The plugin gets fired
    on the PostCreate and looks for if the Regarding Object Id is populated and
    then gets parent organization id and populates the activity entity. The plugin
    works fine when creating Task, Phone from Activity Form but not from the Social
    Pane on the Contact entity.  My plugin is looking for regardingobjectid
    field. When Task or Phone Activities are created from the Social Pane it looks
    like the regardingobjectid is not been passed in the CRM pipeline.

    What am I
    missing? Here is my plugin code

    private
    static string Customer = "regardingobjectid";


         private static string ParentCustomer =
    "my_organizationid";


         public override void HandleAfterOpCreate()


         {


             try


             {


                 if (!
    (this.PluginExecutionContext.PrimaryEntityName.ToLower().Equals(Xrm.Task.EntityLogicalName)
    ||


                       
    this.PluginExecutionContext.PrimaryEntityName.ToLower().Equals(Xrm.PhoneCall.EntityLogicalName)
    ||


                       
    this.PluginExecutionContext.PrimaryEntityName.ToLower().Equals(Xrm.Email.EntityLogicalName)
    ||


                       
    this.PluginExecutionContext.PrimaryEntityName.ToLower().Equals(Xrm.Appointment.EntityLogicalName)))


                     return;


                 base.HandleAfterOpCreate();


                 if (this.PluginExecutionContext.MessageName
    == MessageName.Create)


                 {


                     if
    (this.InputTargetEntity.Contains(Customer))


                     {


                         var
    id = this.OutputID;


                         var
    customerId = ((EntityReference)this.InputTargetEntity.Attributes[Customer]).Id;


                       
     ActivityService.UpdateActivity(id, customerId, this.OrganizationService,
    this.TracingService, this.PluginExecutionContext.PrimaryEntityName.ToLower());


                     }


                 }


             }


             catch (Exception ex)


             {


               
     this.TracingService.Trace(this.ToString() + " {0}",
    "Exception:  {0}", ex.ToString());


                 throw;


             }


         }


    • Edited by SPCRM2011 Thursday, March 6, 2014 5:10 PM
    Thursday, March 6, 2014 5:08 PM

All replies