How can i associate contacts with account using SDK ?
for primary contact it works fine, but i need to associate N contacts with single account based on a criteria.
Everything is working fine except association.
Here is the code
// Create an AssociateEntities linked.
AssociateEntitiesRequest linked = new AssociateEntitiesRequest();
// Set the ID of Moniker1 to the ID of the lead.
linked.Moniker1 = new Moniker()
{
Id = accidstring.Value,
Name = "account"
};
//linked.Moniker1.Id = new Guid("B050F053-6968-DC11-BB3A-0003FFBAD37A");
//linked.Moniker1.Name = EntityName.lead.ToString();
// Set the ID of Moniker2 to the ID of the contact.
linked.Moniker2 = new Moniker()
{
Id = new Guid(contactId),
Name = "contact"
};
//linked.Moniker2.Id = new Guid("1DCDEE97-35BB-44BE-8353-58BC36592656");
//linked.Moniker2.Name = EntityName.contact.ToString();
// Set the relationship name to associate on.
try
{
linked.RelationshipName = "contact_customer_accounts";
// Execute the linked.
svc.Execute(linked);
}
catch
{
linked.RelationshipName = "accounts_contacts";
svc.Execute(linked);
}
( ';')< "I hate this UI"