Monday, August 23, 2021

How to check IsDirty Fields in MSCRM/Dataverse

Hi All,

Please find the Below Code to check what are the fields are DIRTY in MSCRM/Dataverse.

Explanation:

What is mean by Dirty?

    OnLoad of Screen, sometimes we will get UNSAVED CHANGES, because we may Run some scripts in the OnLoad Operation so to find all the Changes happend in the Field we will use Dirty condition to achieve the same.


// Check Form is Dirty

function CheckFormIsDirty() {

    alert(Xrm.Page.data.entity.getDataXml());

}


// Get the Dirty Fields in Alert

function CheckFormIsDirty() {

    attributes = Xrm.Page.data.entity.attributes.get();

    if (attributes != null) {

        for (var i in attributes) {

            if (attributes[i].getIsDirty()) {

                // Display the name and value of the attribute that has changed

                alert(attributes[i].getName());

            }

        }

    }

}

No comments:

Post a Comment

How to Use Multilingual Language in Canvas PowerApps

Introduction: In this Blog, we will see how to use multilingual language in Canvas PowerApps Implementation Steps: 1. Open an Excel and Crea...