Disassociating Relationship Between Two Records

//disassociatingRelationshipBetweenTwoRecords
function disassociatingRelationship() {
    //debugger;
    if (confirm("Do You Want To Diassociate Records"))
    {
        var Id1 = Xrm.Page.getAttribute("nist_lookup").getValue();
        var idValue = Id1[0].id;
        var Id2 = Xrm.Page.data.entity.getId();
        XrmSvcToolkit.disassociate({
            entity1Id: idValue,
            entity1Name: "Account",
            entity2Id: Id2,
            entity2Name: "nist_crudexample",
            relationshipName: "nist_nist_crudexample_account",
            async: false,
            successCallback: function () {
                alert("The records should be disassociated.");
            },
            errorCallback: function (error) {
                alert(error + "error occured");
            }
        });
    }
   
}

Comments

Popular posts from this blog

Meta Data Using WebApiRequest

Sample CRUD Operations Using C# in MSCRM

Basic Plugin Code in D365 using C#