- #region CreatePhoneCallInstances
- public phonecall CreatePhoneCallInstance(string subject, string description, string due)
- {
- //new instance of phonecall
- phonecall call = new phonecall();
- call.subject = subject;
- call.description = description;
- CrmDateTime dueDate = new CrmDateTime();
- dueDate.Value = due;
- call.scheduledend = dueDate;
- CrmDateTime actualStartDate = new CrmDateTime();
- actualStartDate.Value = DateTime.Now.ToString();
- call.actualstart = actualStartDate;
- CrmBoolean frequent = new CrmBoolean();
- frequent.Value = false;
- call.new_frequent = frequent;
- return call;
- }
- #endregion
- #region CreatPhoneCallActivity
- public void CreateMarketingListActivity(string name, string subject, string description, string due, string assignto,List<AccountInfo> accountInfoList, CrmService service)
- {
- try
- {
- //create a marketing list
- list list = new list();
- list.listname = name;
- list.membertype = new CrmNumber();
- list.membertype.Value = 1;
- list.createdfromcode = new Picklist();
- list.createdfromcode.Value = 1;
- Guid listId = service.Create(list);
- // add member
- AddMemberListRequest addMembersReq = new AddMemberListRequest();
- foreach (AccountInfo account in accountInfoList)
- {
- if (account.AllowPhone)
- {
- addMembersReq.EntityId = new Guid(account.AccountID);
- addMembersReq.ListId = listId;
- service.Execute(addMembersReq);
- }
- }
- //
- phonecall phone = this.CreatePhoneCallInstance(subject, description, due);
- CreateActivitiesListRequest req = new CreateActivitiesListRequest();
- req.Activity = phone;
- req.FriendlyName = name;
- req.ListId = listId;
- req.Propagate = true;
- req.OwnershipOptions = assignto == "0" ? PropagationOwnershipOptions.Caller : PropagationOwnershipOptions.ListMemberOwner;
- CreateActivitiesListResponse response = (CreateActivitiesListResponse)service.Execute(req);
- }
- catch (System.Web.Services.Protocols.SoapException ex)
- {
- throw ex;
- }
- catch (Exception exe)
- {
- throw exe;
- }
- }
- #endregion
通過創建Marketing list的方式來創建Quick Campaign
因爲CRM Service不能直接創建web service ,當有時候需要創建的時候N多個phone call的時候,就不得不一個一個的創建,下面是一個通過創建marketing list 的方式來創建Quick campaign , 從而批量的創建phone call activities.
如上所示了,:)。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.