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

Basic Plugin Code in D365 using C#

CURD (Create, Update, Retrieve and Delete) Operation in D365 using Power Shell Script

Meta Data Using WebApiRequest