Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

[AX 2012] Modify form field value in X++

(0) ShareShare
ReportReport
Posted on by 1,087

Hi, 

how do i modify the value of a form field in X++?

 

I  found SetValue() method but doesnt seem to work out. 

Is there a .value property which can be set in order to change the value of a field at runtime?

 

Thank you in advance 

regards

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: [AX 2012] Modify form field value in X++

    You can modify the value in the form control by using the .text() method. (The control have to be the AutoDeclaration property set to Yes).

    or you can try

    Table.field = XX;

    element.redraw();     //to refresh the form

  • Ian_Boothby Profile Picture
    on at
    RE: [AX 2012] Modify form field value in X++

    FormStringControl strResult;

    strResult = element.design().control(element.controlId("strResult"));

    strResult.text("this is what it should say");

  • Raúl Llorente Peña Profile Picture
    685 on at
    RE: [AX 2012] Modify form field value in X++

    In this case the usual way is to set form control values in the super() method of the form, after the super() sentence.

    Note that this shouldn't be appliable to controls related to datasource data.

  • Anton Venter Profile Picture
    19,957 Super User 2025 Season 1 on at
    RE: [AX 2012] Modify form field value in X++

    Can you be more specific? What do you want to do? What is the problem?

  • Codehunter Profile Picture
    10,280 on at
    RE: [AX 2012] Modify form field value in X++

    what method I need to set value while opening form

  • Community Member Profile Picture
    on at
    RE: [AX 2012] Modify form field value in X++

    hey,

    try to save it direkt to the table.

    eg.

    inventTable.field =  value

    inventTable_ds.refresh()

  • Raúl Llorente Peña Profile Picture
    685 on at
    Re: [AX 2012] Modify form field value in X++

    Ok, the easiest way to do so is:

    1.- Set the Autodeclaration property of the control to Yes.

    2.- Now, to set the value in X++, put the name of the control, and the proper method (varies based on the basic data type of the control).

    Examples:

    StringEdit.text("Hello");

       RealEdit.realValue(4.5);

       IntEdit.value(5);

       ComboBox.selection(2);

  • vv1984 Profile Picture
    1,087 on at
    Re: [AX 2012] Modify form field value in X++

    Form controls. More exactly i'm trying to set a text field's value.

  • Raúl Llorente Peña Profile Picture
    685 on at
    Re: [AX 2012] Modify form field value in X++

    Are you speaking about dialog controls, or form controls?

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans