如何将联系人应用到帐户?
所以我有一个帐户和一个联系人
帐户 acc = 新帐户{Name="Ab..",};
联系人 co = new Contact{Name="John", ..};
然后
CreateOneToManyRequest createOneToManyRelationshipRequest =
new CreateOneToManyRequest
{
OneToManyRelationship = new OneToManyRelationshipMetadata
{
//What should I put here?
},
Lookup = new LookupAttributeMetadata
{
//And here?
}
};
CreateOneToManyResponse createOneToManyRelationshipResponse =
(CreateOneToManyResponse)_serviceProxy.Execute(
createOneToManyRelationshipRequest);
我走在正确的轨道上吗?还是有其他方法可以将联系人与帐户相关联?
最佳答案
CreateOneToManyRequest
用于创建实体(而非记录)之间的新关系,即更改数据库架构。我认为这不是你想要做的。
要将特定联系人记录附加到帐户,请设置其 parentcustomerid
属性。这将是一个 EntityReference
或 Lookup
或类似的,并获取该 1:n 关系的第一方的 ID 和类型(“帐户”)。
关于c# - MS Dynamics CRM 中的客户联系关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5178910/