我正在针对CRM中的帐户创建电话呼叫活动,我需要将电话呼叫的属性分配给检索到的帐户相关联系人,我该怎么做,请参阅下面的代码
public static void GetRelevantOutboundCallCenter(IOrganizationService service)
{
QueryExpression qe = new QueryExpression();
qe.EntityName = "account";
qe.ColumnSet = new ColumnSet("new_accountactionedstatus", "name", "telephone1", "primarycontactid");
qe.Criteria.AddCondition("new_deliverystatus", ConditionOperator.Equal, 279640000);
qe.Criteria.AddCondition("new_province", ConditionOperator.Equal, 100000018);
qe.Criteria.AddCondition("statecode", ConditionOperator.Equal, 0);
EntityCollection response = service.RetrieveMultiple(qe);
var counter = 0;
foreach (Entity account in response.Entities)
{
PhoneCall phone = new PhoneCall();
ActivityParty from = new ActivityParty();
phone.OwnerId = from.PartyId = new EntityReference("systemuser", new Guid("6DEFA813-56F9-E411-80CC-00155D0B0C2D"));
ActivityParty to = new ActivityParty();
to.PartyId = account.ToEntityReference();
phone.From = new ActivityParty[] { from };
phone.DirectionCode = true;
phone.To = new ActivityParty[] { to };// I need to set the related Contact of the account here
phone.PhoneNumber = account.Attributes["telephone1"].ToString();
phone.Subject = "TEST FOR OUTBOUND";
service.Create(phone);
counter++;
if (counter == 438)
return;
}
}
这是我设置查询帐户的地方,我需要将其作为与检索到的帐户相关的联系人 - phone.To = new ActivityParty [] {to};
答案 0 :(得分:2)
如果您要将来电分配给帐户更改行的主要联系人
listen http_web 192.168.1.3:80
mode http
balance roundrobin
option httpchk
option forwardfor
server server1 192.168.1.1:80 weight 1 maxconn 512 check backup
server server2 192.168.1.2:80 weight 1 maxconn 512 check backup
到行
to.PartyId = account.ToEntityReference();