web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Inserting Mechanism

(0) ShareShare
ReportReport
Posted on by 383

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

I have the same question (0)
  • Pedro Tornich Profile Picture
    955 on at

    What do you mean by "inserting mechanism"?

    Do you want to know how to create sales orders and purchase orders by code?

  • AhmedSaeed Profile Picture
    383 on at

    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

  • Suggested answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    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.

  • AhmedSaeed Profile Picture
    383 on at

    Hi Satish Panwar ,

    many thank for your response but can you show me how to debug form like purchtable to insert purchase order

  • Verified answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    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.

    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.

  • Verified answer
    Pedro Tornich Profile Picture
    955 on at

    Hi Ahmed,

    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/

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans