Monday, October 23, 2023

Outlining in Visual studio



Hide Selection (Ctrl+M, Ctrl+H): If you want to hide a part of your code, like a specific section within an 'if' statement, you can use this. To show it again, you can use "Stop Hiding Current."


Toggle Outlining Expansion (Ctrl+M, Ctrl+M): If a part of your code is hidden, this will show it. If it's already showing, this will hide it. It's like a switch to hide and show the innermost code section where your cursor is.


Toggle All Outlining (Ctrl+M, Ctrl+L): This command allows you to either hide or show all the hidden parts in your code at once. If some are hidden and some are showing, it makes everything show.


Stop Outlining (Ctrl+M, Ctrl+P): This removes all the hidden parts in your entire document. To turn hiding back on, you would follow the menu path in the original description.


Stop Hiding Current (Ctrl+M, Ctrl+U): If you have hidden a specific part of the code that you defined yourself, you can show it again with this.


Collapse to Definitions (Ctrl+M, Ctrl+O): This hides everything except the titles or definitions of functions, classes, etc., to give you a clean view of what's in your code.


Collapse Block (C++): If your cursor is inside a particular section of code like a loop, you can hide just that section with this command.


Collapse All in (for specific structures): This is a general command that lets you collapse certain logical parts of the code, like functions or loops, depending on what you choose.


These commands are useful in coding environments to help you manage how you view your code, making it easier to work with large files.

Link


If you've made it this far, please leave a kind word. Your encouragement fuels my desire to produce and share even more valuable content.

Friday, October 20, 2023

Turn on navigation path

How to turn on the navigation path in Dynamics 365 fo

Go to System Administration

System administration module

Select System Administration > Setup > Client performance options > 

Client performance option form

Toggle “Yes” to Enable legacy navigation bar

Tada!!!

Wednesday, October 11, 2023

RecordInsertList in Dynamics 365 FO

In this blog of Dynamics Community 101 we will learn RecordInsertList in Microsoft Dynamics 365 F&O

RecordInsertList

In Dynamics 365 Finance & Operations (F&O), the RecordInsertList class is a helpful mechanism for efficiently inserting multiple records into a database table. It's more efficient than using a standard insert in a loop as it batches the inserts, reducing the number of database operations.

Here's a simple example that involves the CustTable, which stores customer information.

Declare a variable of RecordInsertList type - Declare a variable that references a RecordInsertList object. Specify the table you're working with; in this case, the CustTable.

Create the records - Use the new keyword to create a CustTable buffer, and then assign the fields' values.

Add the records to the RecordInsertList - Use the add method on your RecordInsertList object to add each record to the list.

Insert the records - Call the insertDatabase method to insert all the records in the list into the database.

Here's a code snippet to illustrate these steps:

static void InsertCustTableExample(Args _args)

{

    CustTable custTable;

    RecordInsertList recordInsertList = new RecordInsertList(tableNum(CustTable));


    // Loop to create records

    for (int i = 1; i <= 10; i++)

    {

        custTable.AccountNum = strFmt("CUST%d", i);

        custTable.Name = strFmt("Customer %d", i);

        

        // Add the record to the RecordInsertList

        recordInsertList.add(custTable);

    }


    // Insert the records into the database

    recordInsertList.insertDatabase();

    info("Records inserted successfully.");

}


This example will insert 10 records into the CustTable. By using RecordInsertList, you're making the insertion more efficient compared to standard insert operations in a loop. It's a useful tool to have in your arsenal, particularly when dealing with large data sets.

If you've made it this far, please leave a kind word. Your encouragement fuels my desire to produce and share even more valuable content.

Monday, October 9, 2023

Dynamics 365 fo types of functions and classes and special classes

In this blog of Dynamics Community 101 we will learn about types of functions and classes and special classes in Microsoft Dynamics 365 F&O


Interactive type of class

 Functions:



Static Functions: These functions are tied to the class rather than an instance. They can be called without creating an instance of the class. They're commonly used for utility functions that don't rely on instance-specific data.

Instance Functions: These functions require an instance of the class to be invoked. They operate on the data that belongs to the object and are responsible for object-specific behavior.

Main Method: This is the entry point for class execution, usually for testing or batch processing. The main() method is static and can accept command-line arguments.

Final Functions: These are functions that cannot be overridden in derived classes. This ensures that the implementation of the function remains consistent.

Abstract Functions: These functions don't have any implementation in the base class. Derived classes must provide an implementation for these functions, making them ideal for defining a common interface.




Classes:


Table Classes: These classes directly represent tables in the AOT (Application Object Tree). They're automatically created and can be extended but not modified.

Form Classes: These are auto-generated when you create a form in the AOT. They contain methods that run form logic and control form events.

Data Provider Classes: Used primarily for SSRS reports, these classes gather the data that is then displayed on the report.

Framework Classes: These classes provide foundational structures for common functionalities. Classes like RunBase and RunBaseBatch are examples that provide a standardized way to create batch jobs or runnable classes.

Helper Classes: These are custom-defined classes that encapsulate shared logic or functionalities that can be reused across modules.

Controller Classes: These classes act as mediators in complex operations like reporting or batch processing, organizing the overall execution flow.

Contract Classes: These are used to encapsulate parameters for services or reports, making it easier to manage and validate the input.

Extension Classes: These allow you to add new methods to existing table, form, or class objects without altering the original codebase.

Attribute Classes: These are special classes that act as metadata, allowing you to tag elements in the code for additional behaviors or properties.

Map Classes: These simulate tables but don't involve data storage in the database. They're useful for temporary data manipulation tasks.




Special Classes:


Global Class: This class contains global methods and variables that can be accessed across the application, serving as a utility hub.

Application Classes: Classes like Info, ClassFactory, and Global that serve specific application-level functionalities.

Sys Classes: These are system-level classes such as SysDictTable, SysQuery, and SysFormRun. They are crucial for interacting with system-level functionalities and metadata.

If you've made it this far, please leave a kind word. Your encouragement fuels my desire to produce and share even more valuable content.

Thursday, October 5, 2023

Optimizing Disk Space Managing MSSQL Logs on Dynamics 365 (Drive H)

Occasionally, you may encounter disk space issues on your H-drive (logs) due to the continuous filling of the transaction log.




In the displayed screenshot, it's evident that logs partition is nearing its capacity. This has hindered the import of an additional database, as SQL Server notifies me of insufficient disk space.

There is a solution suitable for development settings has been identified.

Follow these steps to manage logs in the AxDB database:

Launch SSMS
In the Object Explorer, navigate to the Databases folder, and right-click on 'AxDB'

In the properties of AxDB, you will see something like below


Here take the name of the second file and replace the name in the below query

Select 'New Query' from the context menu.
In the new query window, input the following code:



USE AxDB;
GO

ALTER DATABASE AxDB
SET RECOVERY SIMPLE;
GO

DBCC SHRINKFILE (AXdb277_log, 1);
GO

ALTER DATABASE AxDB
SET RECOVERY FULL;
GO


Executing this query can help manage the log files in AxDB, improving the performance and maintainability of your Dynamics 365 development environment.



If you've made it this far, please leave a kind word. Your encouragement fuels my desire to produce and share even more valuable content.