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)

Access form control in edit method of a form extension class

(0) ShareShare
ReportReport
Posted on by 95

Hi,

I have added two form controls to a form extension; one drop-down(Field01) and another a text box(Field02). Based on the selection made in drop down the text box gets populated with some description. Now, all this is done in an edit() method in a class (for the form extension). Field02 is not associated to any table, it is just a display of the description. How can I access the text box form control and set a value for it?

Note:- I did not create the edit() in table extension class because of the need to access form control Field02.

e.g. Form extension = PurchTable.Extension

Class Extension:-

[ExtensionOf(formStr(PurchTable))]
final class PurchTable_Extension

{

public static edit Description editField01(PurchTable _this, boolean _set = false, Str60 _recid = "0")

{

_this.Field01 = str2int64(_recid);

//Some more code

// This is where I am trying to access Field02 to set some value to it.

Field02.text("");

}

}

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,990 Most Valuable Professional on at

    If Field02 is bound to a field on PurchTable, you can ignore the control and simply look at the field.

    If it's an unbound control, a solution may be getting a datasource from _this and than a form reference from the form datasource. Then you'll access the control on the form.

  • Priyan Profile Picture
    95 on at

    Field02 is unbound. I got the FormRun object from _this.datasource(). 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