Notifications
Announcements
No record found.
Hello every one,
does any one have a topic about data inserting mechanism in ax like (add new sales order,purchase order and so on)
*This post is locked for comments
What do you mean by "inserting mechanism"?
Do you want to know how to create sales orders and purchase orders by code?
No,I mean if you see most of tables have methods called initfrom.. what is the meaning of this methods and how to reuse it
Hi Ahmed,
Inserting mechanism is kind of same for all tables. Insert method gets called for the table and record gets saved (tables are determined based on what forms you are using).
E.g. Sales table form - Tables are SalesTable, SalesLine, there are many more tables along with these where data gets inserted. What exactly are you trying to achieve by knowing inserting mechanism? You should try to pick one form and try to debug so you can see exactly what goes on. This information can be same for other forms (except table name changes and how complex the form is). E.g. SalesTable is much more complicated than when you see other form like 'payment terms', 'method of payment' etc.
If you are looking for something specific, please add more content to your question. Take a look at link below that talks about different methods:
msdaxtech.blogspot.com/.../table-methods-in-ax-2012.html
initValue - To initialize the record(or to setup default values).
Thanks,
Satish Panwar
Please help verify answer(s) if they guide you in right direction so other community members can also benefit from your question with verified answer.
Hi Satish Panwar ,
many thank for your response but can you show me how to debug form like purchtable to insert purchase order
Take a look at below:
community.dynamics.com/.../code-debugging-and-breakpoints-in-dynamics-ax-2012-x
In your case, instead of putting it in job. Setup breakpoint (F9) in initValue on PurchTable form. Make sure in user options "Execute in CIL" parameter is cleared.
The initFromTable() methods are created by developers when designing tables to ease the task of creating records based on other tables.
For example, all sales order will have informations from the customer, so it's likely to find an initFromCustTable(CustTable _custTable) on the SalesTable.
But, there aren't "initFroms" for all tables, sometimes you will have to write your own code to fill the fields you need.
You can also use AIF classes to create records (sometimes it's easier than writing all the code from scratch). Check the following post to learn more about it: http://dynamics.jeremyginn.net/creating-purchase-orders-in-x/
In addition to debugging, I suggest you use the table browser and look at the data in the tables. When you see what a PurchTable record looks like (and PurchLine), when a purchase order was created from the user interface, you will have a pretty good idea how it should look like if you create it from x++ code.
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 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2