Notifications
Announcements
No record found.
Hi,
I want to get the controls of formRun, I use this approch to get all controls of standard and extension form.
Then I want to get the path of each control.
It is possible to use this approch in D365 Fo?
Thanks.
Hi Basma,
You can copy the form event handler and write the following codes to get every control.
You can right click a control and select Addins - Copy full path to get the path.
Why do you want the path? I think it's enough to know the form name and the control name.
[FormEventHandler(formStr(ProdTableListPage), FormEventType::Activated)] public static void ProdTableListPage_OnActivated(xFormRun sender, FormEventArgs e) { int controlcount; for(int i=1 ; i<=sender.design().controlCount();i ) { controlcount= sender.design().controlCount(); sender.design().controlNum(i);// get every control } }
Thanks WillWU
I need the path of each control in other task.
It is possible to get the path of the form then the controls?
Hmm, so what it the actual requirement? What business problem you're trying to solve?
Understanding the requirement will allow us to give you relevant answers and maybe to suggest a better approach than you've decided to implement it.
Hi Martin,
My requirement is to save all forms with its controls into table ,then create tree with these elements.
That's your technical design - but what's the business problem? What you'll do with the data?
Aren't you interested more in form definition than a particular running form (= a FormRun instance that you asked about)?
I want to use dat in tree.
FormRun let me get all the controls of extension forms. But I don't know to browse form with its extensions to get all controls.
I use this code:
void initEUKSecurityForm() { Form myForm; Args args; FormRun formRun; formBuildDesign design; TreeNode formControl; args = new Args(); args.name(formStr(DirPartyTable)); formRun = classfactory.formRunClass(args); myForm = formRun.form(); design = myForm.design(); formNode=TreeNode::findNode(myForm.treeNodePath()); initEUKSecurityFormControl(formNode,levelId,myForm.name()); }
void initEUKSecurityFormControl(TreeNode _formNode, int _levelId, str _forname) { Object formControl; TreeNode controlNode = TreeNode::findNode(#FormsPath #doubleAntiSlash _formNode.treeNodeName() #doubleAntiSlash #Designs #doubleAntiSlash #DesignList); TreeNodeIterator iteratorControl = controlNode.AOTiterator(); TreeNode childControlNode = iteratorControl.next(); while(childControlNode) { elementName = findProperty(childControlNode.AOTgetProperties(),#PropertyName); elementPath = childControlNode.treeNodePath() ; childControlNode = iteratorControl.next(); } }
But I get only the controls that exists in standard form
You could use the new metadata API, for instance, but that's a very different question than the topic of this thread ("How to traverse the controls of FormRun").
I can't say which approach you need unless you explain what you're trying to achieve. Even your two approaches, if they worked, would give you different results in some cases. Think of form controls added at runtime...
I tell you what is the requirement of this data : use this data into tree.
Sorry, there is nothing more I can do for with this kind of specification.
If this all you've got from your customer, you should go back to them and ask what they actually need from the business perspective. First collect the requirements, then think about how to solve the problem from both the functional and technical perspective. Only then, if you realize that it requires a customization, there will be time to start coding.
have you any idea about how to get all controls of form extension ?
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 559 Most Valuable Professional
André Arnaud de Cal... 464 Super User 2025 Season 2
Sohaib Cheema 250 User Group Leader