web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to reference the original value of a field on a form inside the modified method.

(0) ShareShare
ReportReport
Posted on by 130

Hi,

Per the title. I've overridden the modified method on a StringEdit that references a CustAccount field to something like this

public boolean modified()
{
    boolean ret;

    ret = super();

    if ( ?????????? != this.valuestr())
        {
            ds_ProjectLine.CustAccountName = CustTable::find(this.valueStr()).Name;
            ds_ProjectLine.ContactPersonId = '';
            ds_ProjectLine.ContactPersonName = '';
        }

    return ret;
}

I didn't have the if statement originally, but in testing if I clicked to change the CustAccount from 113875 and I selected 113875 (so no change) then it still fired and wiped out the ContactPerson values. So I just want to test against the original value. But how do I reference it???

I've read in forums that if I had this at the Table level and used the modifiedfield method then I could reference this.orig() but it feels more like I want to do this at the form level.

Any suggestions???

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Adam Duckworth Profile Picture
    130 on at

    I figured it out. Just cause I'm not in the table doesn't mean I can't use the orig() method.

    This works how I want:

    public boolean modified()
    {
        boolean ret;

        ret = super();

        if (ds_ProjectLine.orig().CustAccount != ds_ProjectLine.CustAccount)
            {
                ds_ProjectLine.CustAccountName = CustTable::find(ds_ProjectLine.CustAccount).Name;
                ds_ProjectLine.ContactPersonId = '';
                ds_ProjectLine.ContactPersonName = '';
            }

        return ret;
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans