I running this piece of code and this creates a Connection Record in the case mentioned here. But it doesn't add the Contact in the ConnectionTo Field. Is this not the right way of creating a connection record?
var data = {
"record2id@odata.bind": "/contacts(47655a8a-44ac-e911-8199-000d3a71c895)",
"record2roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)",
"record1id@odata.bind": "/incidents(caef5d28-b8a9-e911-8199-000d3a71c895)",
"record1roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)"
}
parent.Xrm.WebApi.createRecord("connection", data).then(
function success(result) {
alert("Success. Id: " + result.id);
},
function (error) {
parent.Xrm.Utility.alertDialog('Connection error - ' + error.message);
}
);