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

Community site session details

Session Id :
Dynamics 365 Community / Blogs / Dynamics 365 Tech Blog / Dynamics 365 Using a tempor...

Dynamics 365 Using a temporary table in X++

feelyd Profile Picture feelyd 260

Dynamics 365 for Finance and Operations contains numerous temporary tables that are used by the application. We also have the option of creating Temporary tables based on any of the existing table in the AOT. They can be created in order to hold temporary data for the duration of a code block or snippet. As an example, we will use the customer to insert and display a couple of temporary records without affecting the actual data.

1 As an example, we will use the customer table to insert and display a couple of temporary
records without affecting the actual data stored in Dynamics 365. Lets add a new class to our Visual Studio Project. Right Click project name

Step 1 image

2 Click Add a new item, we are going to add a new class for our temporary table

Step 2 image

3 Click New Item. In the pop up window which is displayed I am going to select code in the left hand window. This will show me all the code options I can add

Step 3 image

4 select runnable class in the code pane options and give the class a name. I am going to call the class RunnableClassCustomerTempTable

Step 4 image

5 Right Click our new class object RunnableClassCustTempTable. Click in the menu option which is displayed Set as Startup Object. This will run this code when we start to run the project

Step 5 image

6 In the code pane of the class enter the following lines of code. The key method in this recipe is setTmp(). This method is available in all the tables, and it makes the current table instance behave as a temporary table in the current scope.

Step 6 image

Comments

*This post is locked for comments