locked
Closing Campaign Activities CRM 2011 RRS feed

  • Question

  • I am a crm user and struggling to figure out how to close my campaign activities properly. 

    I create a campaign activity of phone calls for our sales staff to call. These call lists can be very large and sometimes the offer is finished before all calls have been completed. When i close that campaign activity the calls are still active in the call lists.

    Is this the proper function on closing an activity? If so what is the best way to close the remaining open calls from there activity list.

    Thank you in advance for your comments.

    Friday, November 15, 2013 9:56 AM

All replies

  • check out below code, it is for canceling the activity.

     // Cancel an Activity
          private static void CancelActivity(Entity entity, IOrganizationService service)
          {
              EntityReference moniker = new EntityReference();
              if (entity.LogicalName == "activitypointer")
              {
                  if (entity.Attributes.Contains("activityid") & entity.Attributes.Contains("activitytypecode"))
                  {
                      moniker.LogicalName = entity.Attributes["activitytypecode"].ToString();
                      moniker.Id = (Guid)entity.Attributes["activityid"];
                      SetStateRequest request = new SetStateRequest();
                      request.EntityMoniker = moniker;
                      request.State = new OptionSetValue(2);
                      request.Status = new OptionSetValue(-1);
                      SetStateResponse response = (SetStateResponse)service.Execute(request);
                  }
              }
          }
    

    • Proposed as answer by Venkat_Reddy Thursday, December 12, 2013 7:35 PM
    Friday, November 15, 2013 3:11 PM