locked
Trouble Inserting CampaignResponse with Plugin RRS feed

  • Question

  • I am new to both CRM and Scribe and am having trouble inserting a campaign response and getting the customer object. from the response below is the code that is running to get this data. Scribe is inserting the campaign response and then activityparty. Seems like the following should work.

            private static EntityCollection GetCustomer(IPluginExecutionContext context, Entity entity, IOrganizationService service, Entity crCurrentCR)
            {
                EntityCollection customer = null;

                //why get customer from entity if create and from campaignresponse if update?
                if (context.MessageName == "Create")
                {
                    if (entity.Contains("customer"))
                    {
                        customer = (EntityCollection)entity["customer"];
                    }
                }
                else
                {
                    //determine the user if scribe or ui
                    Entity eSystemUser = service.Retrieve("systemuser", context.InitiatingUserId, new ColumnSet("fullname"));
                    if (eSystemUser["fullname"].ToString() != "INTEGRATION")
                    {
                        //if ui execution use this
                        if (crCurrentCR.Contains("customer"))
                        {
                            customer = (EntityCollection)crCurrentCR["customer"];
                        }
                    }
                    else
                    {
                        //if scribe execution use this


                        //This is previous code that did not work
                        //the collection is empty
                        customer = (EntityCollection)crCurrentCR["customer"];

                    }

                }
                return customer;
            }

    Monday, February 16, 2015 10:38 PM