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)

[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

I have the same question (0)
  • Raúl Llorente Peña Profile Picture
    685 on at

    Are you speaking about dialog controls, or form controls?

  • vv1984 Profile Picture
    1,087 on at

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

  • Raúl Llorente Peña Profile Picture
    685 on at

    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);

  • Community Member Profile Picture
    on at

    hey,

    try to save it direkt to the table.

    eg.

    inventTable.field =  value

    inventTable_ds.refresh()

  • Codehunter Profile Picture
    10,280 on at

    what method I need to set value while opening form

  • Anton Venter Profile Picture
    20,346 Super User 2025 Season 2 on at

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

  • Raúl Llorente Peña Profile Picture
    685 on at

    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.

  • Ian_Boothby Profile Picture
    on at

    FormStringControl strResult;

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

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

  • Community Member Profile Picture
    on at

    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

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