Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, Power Apps, Power Automate, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I need to create multiple tables dynamically through X++ code. There are multiple codes available for creation of tables. But once the table is created and in the same code we want to use that table's buffer to insert record. How to use that.
Like we have created a table through X++ named "MyTable". And then in the same method or class, I want to use this table. But I can't create a table buffer for this MyTable as it will give compile time error that this table doesn't exist.
So please share how to use a table which is we are creating through X++ code.
Even if you succeed with creation of table somehow , in production you deploy binaries so how those are going to work ? Better you rethink about your requirement.
If you explain your business requirement, we may be able to suggest a feasible technical solution.
I know it is not a good solution. I have to discuss this with FC. But for now, let me explain the scenario a bit.
Actually, the process is for dynamic document creation of any type. It will be used for HR.
Functionality has a lot of things and glitches but for a basic case:
User has the option to specify as many fields as he wants to show on the form. User will specify all the fields in the setup form and will specify its type as well. Fields can be free text or ENUMs or lookup fields. For every lookup field, we need to create a setup form dynamically (through code) where he will enter the master data which will be used for lookup.
It is not clear what you want to achieve in the end, but what you have described in your last comment sounds like Custom fields: docs.microsoft.com/.../user-defined-fields
Can we use these custom fields in workflows?
You can't create AOT tables in runtime, only in design time in Visual Studio, in a dev system.
We need to dynamically add fields on the form and then use them in workflows as well. Can custom fields be used in workflows conditions? Apparently, it looks custom fields can only be used on the forms and in the entities.
Thanks for your reply.
I have seen this type of code in many blogs. This also creates a new table through code.
Am is confusing something?
treeNode = TreeNode::findNode(#TablesPath);
That code is for AX2012 where you can develop new AOT objects in runtime, and even develop in Prod. In d365FO all dev work is done in Visual Studio in a dev system. You can't create AOT objects with x++ anymore, only with Visual Studio.
As already mentioned, these things are not possible anymore - you'll have to design a different technical solution, or even to rethink the design of business processes.
What's the business case behind "User has the option to specify as many fields as he wants to show on the form"?
In AX 2012, other than creating a new table, we could create fields on an existing table, create new forms, create new controls on the forms, etc. through x++. So if we can't do any of these things through code or it is only for new tables that we can't create new tables through code but we can still do other things from X++ code?
There are multiple types of documents that we can create in the system. Like annual performance review document, termination letter, experience letter etc.
Lets say Annual performance review form for an employee:
HR wants to create multiple KPI/Fields. And on the bases of those KPI/Fields, they need to set up the workflows as well.
Development is done in development environments. Then all code and metadata is built to binaries (such as DLL files) and these binaries are installed to other environments, including production. You can change behavior at runtime by X++, but you can't change the binaries. That includes everything, not just tables.
Although doing such things used to be possible, it was very dangerous and sometimes horribly abused...
You can't create any AOT objects in runtime of D365FO. So it's not just about tables.
In D365FO the source code and metadata are created and modified with Visual Studio in a development system. Then, a build system builds .Net assemblies (DLL) files from the source code objects (which are xml files) to create a deployable package.
The runtime uses these DLLs to run the application logic. The runtime can't manipulate source code or build new DLLs.
So, design and runtime are fully separated in D365FO, unlike in AX2012.
Well, maybe "they want" isn't a sufficient business justification. Is it really impossible to identify data needed for things like annual performance review in advance and develop it in the usual way?
Anyway, I would rather don't allow HR define data models. They're simply not trained to do such things.
Business Applications communities