Skip to main content

How to compare old and new values at the time of updating in D365. #D365 #X++ #Dynamics

I was required to track the changes made on some specific fields on a table. When those fields are changed, I need to trach the RecId of that record.
So I wrote this code in the update() method Coc. 

public void update()
        boolean isMainAccountModified;
        if (this.orig().Name != this.Name  
            || this.orig().MainAccountId != this.MainAccountId
            || this.orig().CRExpense != this.CRExpense
            || this.orig().SuspendedDate != this.SuspendedDate)
            isMainAccountModified = true;
        next update();
        if (isMainAccountModified)


*This post is locked for comments