简体   繁体   English

MS Dynamics CRM中的帐户联系人关系

[英]Account Contact Relationship in MS Dynamics CRM

How do I apply a contact to an account? 如何将联系人应用于帐户?

So I have an account and a contact 所以我有一个帐户和一个联系人

Account acc = new Account{Name="Ab..",}; 帐户acc =新帐户{Name =“Ab ..”,};

Contact co = new Contact{Name="John", ..}; 联系我们=新联系人{Name =“John”,..};

And then 然后

CreateOneToManyRequest createOneToManyRelationshipRequest =
                        new CreateOneToManyRequest
{
   OneToManyRelationship = new OneToManyRelationshipMetadata
   {
       //What should I put here?
   },
   Lookup = new LookupAttributeMetadata
   {
       //And here?
   }
};
CreateOneToManyResponse createOneToManyRelationshipResponse =
                        (CreateOneToManyResponse)_serviceProxy.Execute(
                        createOneToManyRelationshipRequest);

Are I on the right track? 我是在正确的轨道上吗? or is there some other way of connecting contacts to accounts? 或者是否有其他方式将联系人连接到帐户?

CreateOneToManyRequest is used to create a new relationship between entities (not records), ie change the database schema. CreateOneToManyRequest用于在实体(而不是记录)之间创建新关系,即更改数据库架构。 I take it this is not what you want to do. 我认为这不是你想要做的。

To attach a specific contact record to an account, set its parentcustomerid property. 要将特定联系人记录附加到帐户,请设置其parentcustomerid属性。 Thîs will be an EntityReference or Lookup or the like and take the ID and type ("account") of the 1 side of that 1:n relationship. 这将是EntityReferenceLookup等,并获取该1:n关系的1侧的ID和类型(“account”)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM