Hello All Experts,
I am using below code to create connection between account and contact .
Connection newConnection = new Connection
{
Record1Id = new EntityReference(Account.EntityLogicalName, accountRef.Id),
Record1RoleId = new EntityReference(ConnectionRole.EntityLogicalName,(Guid)_connectionRoleId[0]),
Record2RoleId = new EntityReference(ConnectionRole.EntityLogicalName, (Guid)_connectionRoleId[0]),
Record2Id = new EntityReference(Contact.EntityLogicalName,entityContact.Id)
};
var _connectionId = context.OrganizationService.Create(newConnection);
this always gives an error as below
The record type 2 is not defined for use with the connection role 7ad04eae-5580-e411-9407-005056922296.
and when i try to comment either of the below line of code then record is getting created but Role To field is empty in Associated connection view grid.
Record1RoleId = new EntityReference(ConnectionRole.EntityLogicalName,(Guid)_connectionRoleId[0]),
Record2RoleId = new EntityReference(ConnectionRole.EntityLogicalName, (Guid)_connectionRoleId[0]),
any help will be appreciable.