Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Read values from Dynamic form controls in D365FO

(1) ShareShare
ReportReport
Posted on by 297
Hello,
I need to read the value from a dynamically added form control on button click event. 
Specifically, I need to read values of the custGroup field on create new customer form on clicked event of the Save button. The regular code will not work here because the control names are not identified
 
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,493 Super User 2024 Season 2 on at
    Read values from Dynamic form controls in D365FO
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,493 Super User 2024 Season 2 on at
    Read values from Dynamic form controls in D365FO
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,642 Super User 2024 Season 2 on at
    Read values from Dynamic form controls in D365FO
    Hi Srikanth,

    The control you marked is bound to a DataSource field. You can get the value from the DirPartyEntity (CustTable) datasource, field CustGroup. When initializing the form, the datasource table is replaced with CustTable and the fields displayed are coming from field groups.
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,493 Super User 2024 Season 2 on at
    Read values from Dynamic form controls in D365FO
    Hi,

    Is your issue resolved?  If yes, mark the answers that helped you as verified.

    Thanks
    Waed Ayyad
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 6,493 Super User 2024 Season 2 on at
    Read values from Dynamic form controls in D365FO
    Hi,
     
    In the event handler code of clicked button, you can't directly get the value of control. You should call it as in the following code:
    FormRun formRun = sender.formRun();
    FormStringControl custGroup= formRun.design().controlName(formControlStr(FormName, ControlName)) as
    ​​​​​​​ FormStringControl; info(custGroup.valuestr());
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
     

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans