How to iterate ButtonGroupControl in Form Extensions

Hello Please I have a quick question in Dynamics 365 FO

I want to iterate FormButtonGroupControl in Form Extensions > Controls

pastedimage1574343895073v1.png

Based on some reasearches , i have the Following code

Here i iterate all form extensions of CustTable, but i dont know how to loop FormButtonGroupControl

public static void main(Args _args)
{
CLRObject list;
var t = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetFormExtensionNames(“CustTable”);

list = t.getEnumerator();
while(list.moveNext())
{
var extensionFormname = list.get_current();
AxFormExtension extendedForm = Microsoft.Dynamics.Ax.Xpp.MetadataSupport::GetFormExtension(extensionFormname);
var enumerator = extendedForm.Controls.GetEnumerator();
while(enumerator.MoveNext())
{
AxFormExtensionControl extCtrl = enumerator.Current;
str nameOfControl = extCtrl.FormControl.Name;
if(extCtrl.FormControl.Type == MetaModel.FormControlType::ButtonGroup)
{
//Here i want to iterate the formButtonGroupControl and Get "FormButtonControl1"
pastedimage1574344277267v2.png
}

}
}
}

Thanks in advance

It looks like a continue of the discussion we have in the Dynamics community forum for last few days…

Cast the variable to the right type and then use the Controls property to get the collection of child controls. Then simply iterate the collection.

You can find an example in my blog post New metadata API.

Why don’t want form button control iteration ? Please explain clearly