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 call the current field value in data source form in Modified method AX 2012

(0) ShareShare
ReportReport
Posted on by 10,280

i need to update specific field in modified method based upon select statement 

How can i do that??

Plz anybody replies to me??

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,917 Super User 2025 Season 2 on at

    Hi Codehunter,

    Can you please be more specific? What do you mean with "select statement"? Can you please describe the scenario? Which field was modified in what table or form which should trigger to update which field(s)?

  • Codehunter Profile Picture
    10,280 on at

    i need to add modified method on field of data source

    once i changed field control value,i got message box with the modified one

  • André Arnaud de Calavon Profile Picture
    300,917 Super User 2025 Season 2 on at

    Hi Codehunter,

    Sorry, but I really don't get your requirement. You also ignored some some my questions. Please be more clear. If I read your question and reply, then first you want to update a field. Now you are talking about a message box. You are confusing me. In this way I cannot help you.

  • Community Member Profile Picture
    on at

    Hi Mr. Codehunter,

    Your questions are not clear enough to understand your real issue.

    Please be descriptive about your issue scenario.

    Please use screen shot to explain your case, as you statements are very difficult to understand.

    Please put your efforts while asking questions so that team members in the forum can understand your case and get benefited.

    Please take care while writing any statement.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi codehunter,

    I agree, question is really confusing and please consider what Andre and Nitesh said. However, I am replying by guessing your requirement.

    Question heading: how to call the current field value in data source form in Modified method AX 2012

    Answer: There can be different ways for calling current inserted value in a field

     - DataSourceName.Field (e.g. in if datasource is custTable then custTable.currency)

     - Make autoDecalaration yes on control in Design and refer to the control value ControlName.valueStr(). There are more methods to get value.

    Question statement: i need to update specific field in modified method based upon select statement 

    Answer: You can use select statement just like you use in any other method. If it is of same datasource, just write like custTable.fieldToUpdate = "New value" (Datasource name will be pointing to the selected record)

    If it is another table/datasource you can select that table for update and can perform update.

    Another Statement: Question related to dialog on modified method

    Answer: If you are intended to use some interactive dialog while value is changed (which i got from your reply to Andre) there are more ways. Have a look to following code from technet

    static void JobBoxDemo(Args _args)
    {
        DialogButton diagBut;
        str strMessage = "The No button should have initial focus.";
        str strTitle = "Title";
        ;
        diagBut = Box::yesNoCancel(
            strMessage,
            DialogButton::No, // Initial focus is on the No button.
            strTitle);
        if (diagBut == DialogButton::No)
            {
                print "The No button was clicked.";
            }
        else
            {
                print "The button that was clicked was: ", diagBut;
            }
        pause;
    }


    Regards

    Syed

     

  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    As two have already suggested you to describe your requirements either more details or with screen shots.

    What I got from your requirement is that you want to perform an action (insert or update or whatever it is, might be show message box) when your desired field modified.

    Best practice to write modifiedField method at table level you can have a look on SalesTable | Methods | modifiedField method for better understanding. Though this method is not the best example for what you are trying to achieve, can give you an idea to understand.

    For more information about methods on Form's datasource and at table's level please go through this slideshare which easily describes you what is best and where to write code.

    daxture.blogspot.co.nz/.../ax-2012-forms-and-tables-methods-call.html

    You can get your answer on slide # 12.

  • Codehunter Profile Picture
    10,280 on at

    i need to add modified method inside Form Data source -->Table-->Field then add modified method on that field to get the last updated control value after modification

    Hope you get what i mean.

  • Suggested answer
    Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Please have a look on below example; I added CustTable table as a datasource and override modifiedField method for bank account number field. You can retrieve value of bankAccount by using CustTable.BankAccount statement. Please be advised that in this statement CustTable is the name of the datasource, sometime when we add tables on forms datasource it generates name e.g. CustTable_DS so you need to specify correct datasource name.

    I would again suggest you to write this modifiedField logic at table level as a best practice or you can tell me why do you want to write code over form's datasource table.

  • Faisal Fareed Profile Picture
    10,796 User Group Leader on at

    Is your question answered ?

  • Suggested answer
    UmesH@ Profile Picture
    810 on at

    Override modified method of that lookup field get values from parent table and fill in grid fields.

    Like

    //Student Table name
    
    Display str StudentName()
    {
        A_Student _Student;
        ;
        select Student_Name from _Student where _Student.Student_ID== this.Mark_Student;
        return _Student.Student_Name;
    }
    
    //fill stringedit by changing dropdown
    //set this method in sub table method node

    Set StudentName Method Name in Which Grid Field You Want to Fill Student.Name

    Thanks.

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans