将成员添加到 CRM 2011 工作流活动中的市场营销列表

本文关键字:活动中 市场营销 列表 工作流 2011 成员 添加 CRM | 更新日期: 2023-09-27 18:33:52

我正在尝试将成员添加到 CRM 2011 工作流活动中的市场营销列表中。在执行以下代码后,它表示fromListCreated 成员计数为 0,而它应该是 1。我已经验证members[0]AddMemberRequest.MemberIds[0]确实包含成员 GUID。有谁知道我错过了什么?

List fromList = new List();
List fromListCreated = new List();
fromList.CreatedFromCode = new OptionSetValue(2);
fromList.ListName = "My List";
Guid fromListGuid = service.Create(fromList);
var list = service.Retrieve("list", fromListGuid, new Microsoft.Xrm.Sdk.Query.ColumnSet(true));
fromListCreated = service.Retrieve(list.LogicalName, list.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet(true)).ToEntity<List>();
Guid emailFrom = Guid.Empty;
if (EmailFrom != null)
{
    emailFrom = EmailFrom.Get(executionContext).Id;
}
else
{
    // Default to the inhouse attorney user
    emailFrom= thisCase.lgl_inhouseattorneyid.Id;
}
Guid[] members = new Guid[1];
members[0] = emailFrom;
AddListMembersListRequest AddMemberRequest = new AddListMembersListRequest();
AddMemberRequest.ListId = fromListCreated.Id;
AddMemberRequest.MemberIds[0] = members[0];
AddListMembersListResponse AddMemberResponse = service.Execute(AddMemberRequest) as AddListMembersListResponse;
service.Update(fromListCreated);

将成员添加到 CRM 2011 工作流活动中的市场营销列表

据我所知:

fromListCreated 在 AddListMembersListRequest 之后尚未更新。任何 crm 请求都不会更新此对象。我相信这个对象应该通过检索请求更新回来。

该成员是否已添加到市场营销列表中?