Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Read values from Dynam...
Finance forum
Suggested answer

Read values from Dynamic form controls in D365FO

Posted on by 249
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 5,029 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 5,029 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... 290,115 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 5,029 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 5,029 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
     
     

Helpful resources

Quick Links

Dynamics 365 Community Update

Welcome to the inaugural Community Platform Update. As part of our commitment to…

Dynamics 365 Community Newsletter - August 2024

Catch up on the latest D365 Community news

Community Spotlight of the Month

Kudos to Mohana Yadav!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,115 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 227,969 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans