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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Suggested Answer

use of Table.InitValue()

(0) ShareShare
ReportReport
Posted on by 56

Dear All,

I saw in many standard code that when they insert records in table. So, they called Table.InitValue() then Table. insert().

Example :

TTsbegin;

Table.InitValue()

// to do

Table.Insert();

TTScommit;

Can you please let me know when we called Table.initValue() what impact will happened before insert records in table? 

TTSbegin and TTScommit is mandatory to write on Table.insert().

Please give me more shed on this.

Thanks!
Arpan Sen

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Sefa Duman Profile Picture
    1,167 on at

    Hi Arpan,

    See this topic for detailed information:

    [View:https://community.dynamics.com/ax/f/33/t/161489]

  • @rp@n Profile Picture
    56 on at

    Thanks Sefa

  • Pravasti AK Profile Picture
    2,985 on at

    Hi,

    Please refer the below link:

    https://community.dynamics.com/ax/f/33/t/161489

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Specifically calling initValue() is a good idea, but there are more detailed explanations in the linked topics.

    They usually initialize values which should be populated with a default value, like for SalesTable's Sales status you do not want to have None, but rather the enumeration value which belongs to Open sales order, which is not the first entry for the SalesStatus enum. In that case you'd want to initialize it, and that is done in initValue() call as the first step after the .create() operation on the record buffer. You can also find buffer-based initalization which can be seen as initFromTableName(), to copy over values, like from SalesTable to SalesLine.

    TTS block is not required for insert operations, unless you have business logic there that is not for that table in question. TTS block should only be used if you want to roll back the entire section that happens in there in case anything raises an error, so is typically used if you have postings, multiple table inserts, and so on, so you do not leave behind half-baked transactions.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans