In this example I associate contact with an account
function associateRec()
{
var stdId = Xrm.Page.data.entity.getId();//get Account record's GUID
XrmServiceToolkit.Rest.Associate(
stdId,
"AccountSet",
"0F383E15-1047-E511-80D7-3863BB3C5778",//contact record's GUID which u want to associate
"ContactSet",
"contact_customer_accounts",//account and contact relationship name
function () {
alert("Associated"); //Success - No Return Data - Do Something
},
function (error) {
alert(error.message);
},
true
);
}
function associateRec()
{
var stdId = Xrm.Page.data.entity.getId();//get Account record's GUID
XrmServiceToolkit.Rest.Associate(
stdId,
"AccountSet",
"0F383E15-1047-E511-80D7-3863BB3C5778",//contact record's GUID which u want to associate
"ContactSet",
"contact_customer_accounts",//account and contact relationship name
function () {
alert("Associated"); //Success - No Return Data - Do Something
},
function (error) {
alert(error.message);
},
true
);
}