我正在尝试将成员添加到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);
答案 0 :(得分:0)
据我所见:
在AddListMembersListRequest之后,fromListCreated尚未更新。任何crm请求都不会更新此对象。我相信这个对象应该通过检索请求更新回来。
该会员是否已加入营销列表?