Friday, December 15, 2023

How to pass Arguments/records in RDP Report through form or how to open report from the Form using controller class X++ in Dynamics 365 FO

Pass arguments in RDP Report through form in D365 FO on Dynamicscommunity101

How to pass Arguments/records in RDP Report through form, how to open report from the Form using controller class X++ in Dynamics 365 FO

Dynamics 365 FO Opening Dialogue form through X++

Dynamics 365 FO Opening Dialogue form through X++

Dynamics 365 X++ OData Actions

Dynamics 365 X++ OData Actions

Enable Power Platform Integration

Enable Power Platform Integration

File based integration(Import) using Logic apps -D365 FO Enqueue Dequeue

File based integration(Import) using Logic apps -D365 FO

Selection changed and active method in Dynamics 365 FO

1. Selection Changed Method:

   - This method is triggered when the selection of a record in a grid or a form changes.

   - It is commonly used to handle scenarios where actions need to be taken based on the user's selection of a record. For example, enabling or disabling buttons, displaying additional details of the selected record in another form part, or refreshing data based on the new selection.

   - The Selection Changed method is associated with the form's data source and is typically overridden in the form's data source class.

2. Active Method:

   - The Active method is called whenever a record in a form is activated or when the focus is set on a record.

   - It's used to perform actions every time a record becomes active, which might not necessarily be due to a change in selection. For example, it can be used to display additional details of the record or to execute some logic related to the active record.

   - This method is also associated with the form's data source and can be overridden to provide custom logic whenever a record becomes active in the form.

In essence, while the "Selection Changed" method is specifically about the change in the selection of records, the "Active" method is more about a record gaining focus or becoming the currently active record, regardless of whether it was selected previously or not. Both are important in managing the behavior and interaction of forms in Dynamics 365 F&O.

Dynamics 365 FO code to generate access token and parse the JSON response using contract class to get the access token

1. Class LSGenerateToken :

using System.Net.Http;

using System.Text;

internal final class LSGenerateToken


    public static void main(Args _args)


        str responseJson;

        HttpClient httpClient = new HttpClient();

        str requestUrl = '';

        str body = strFmt("grant_type=client_credentials&client_id=%1&client_secret=%2",


        // Send the request and get the response

        HttpResponseMessage response = httpClient.PostAsync(requestUrl, new StringContent(body, Encoding::UTF8, "application/x-www-form-urlencoded")).Result;

        str responseBodyStr;

        if (response.IsSuccessStatusCode)


            // Parse the response body

            var responseBody = response.Content.ReadAsStringAsync().Result;

            responseBodyStr = responseBody;




            // Handle error

            throw error(strFmt("Failed to get access token. Status code: %1", response.StatusCode));


        LSAccessTokenContract _Contract = FormJsonSerializer::deserializeObject(classNum(LSAccessTokenContract), responseBodyStr);

        info(strfmt("Access token = %1",_Contract.parmaccess_token()));



2. LSAccessTokenContract :


class LSAccessTokenContract


    str token_type;

    str expires_in;

    str ext_expires_in;

    str expires_on;

    str not_before;

    str resource;

    str access_token;


    public str parmtoken_type(str _token_type = token_type)


        token_type = _token_type;

        return token_type;



    public str parmexpires_in(str _expires_in = expires_in)


        expires_in = _expires_in;

        return expires_in;



    public str parmext_expires_in(str _ext_expires_in = ext_expires_in)


        ext_expires_in = _ext_expires_in;

        return ext_expires_in;



    public str parmexpires_on(str _expires_on = expires_on)


        expires_on = _expires_on;

        return expires_on;



    public str parmnot_before(str _not_before = not_before)


        not_before = _not_before;

        return not_before;



    public str parmresource(str _resource = resource)


        resource = _resource;

        return resource;



    public str parmaccess_token(str _access_token = access_token)


        access_token = _access_token;

        return access_token;



Thursday, December 14, 2023

Mastering Transaction Control in Dynamics 365 FO Understanding ttsBegin ttsCommit and ttsAbort

In Microsoft Dynamics 365 for Finance and Operations, which is built on the X++ programming language, ttsBegin, ttsCommit, and ttsAbort are commands used to manage database transactions. These commands ensure data integrity and consistency during database operations. 

1. ttsBegin: This command starts a database transaction. When you execute ttsBegin, it tells the system that you are starting a series of operations that should be treated as a single unit. If any operation within this unit fails, the entire set of operations should be rolled back to maintain data integrity.

2. ttsCommit: This command is used to commit the transaction. It signals the successful completion of all operations within the transaction started by ttsBegin. When ttsCommit is executed, all changes made to the database within the transaction are permanently saved.

3. ttsAbort: This command is used to abort the transaction. It's invoked when an error occurs or when there's a need to undo the operations performed after ttsBegin. Executing ttsAbort rolls back all changes made during the transaction, restoring the database to its state before ttsBegin was executed.

Transaction Levels:

- Dynamics 365 F&O supports nested transactions. This means you can have multiple levels of ttsBegin commands. 
- Each ttsBegin must have a corresponding ttsCommit or ttsAbort. 
- The system keeps track of transaction levels. A ttsCommit only decreases the transaction level by one. The transaction is only committed to the database when the outermost ttsCommit (when the transaction level reaches zero) is executed.
- If a ttsAbort is executed at any level, all changes in the current transaction level and any nested levels are rolled back.


Imagine you are updating customer data in a transaction. The code structure would look like this:

ttsBegin;  // Start the transaction
    custTable.Name = "Customer Name";
    ttsCommit;  // Commit the transaction
    ttsAbort;  // Abort the transaction if an error occurs

In this example, if the customer update fails, the ttsAbort in the catch block will be triggered, rolling back both updates to maintain data consistency.

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, December 7, 2023

Relationship type property while creating relation in Dynamics 365 FO

In Dynamics 365 Finance and Operations (F&O), the following are the types of relationships between entities:

Association: An association is a relationship between two or more entities where they are linked together based on some common attribute or characteristic. For example, When a customer places an order, there is an association between the customer entity and the order entity, linked by a unique customer ID.

Composition: Composition is a type of association where the entities are dependent on each other, and the child entity cannot exist without the parent entity. For example, A customer profile may be composed of multiple sub-entities like billing addresses, shipping addresses, and payment methods. These sub-entities cannot exist without the customer profile.

Link: A link is a type of association that defines a connection between two entities but does not imply any dependency or ownership. For example, The customer entity could be linked to a loyalty program entity, indicating that this customer is a part of a specific loyalty program but not dependent on it.

Specialization: Specialization is a relationship between entities where one entity is a more specific version of another entity. For example, Customers can be specialized into different types such as "retail customer," "wholesale customer," or "online customer."

Aggregation: Aggregation is a relationship between entities where one entity is composed of or made up of other entities. For example, A household may aggregate multiple individual customer accounts under one umbrella, like a family account.

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.

Wednesday, December 6, 2023

Maps and MapEnumerator in Dynamics 365 FO

In Dynamics 365 Finance & Operations (F&O), a "map" is used for organizing and storing data.

Unique Keys: Just like each word in a dictionary is unique, each 'key' in a map is unique. A key is a label or identifier you use to find a specific piece of data (like a word in a dictionary helps you find its definition).

Data Types: The keys and the data (values) they point to can be of any type. For example, a key could be a number, and the value could be a name or a date.

Efficiency: Maps are designed to let you quickly find data. If you know the key, you can immediately find the value.

Usage: In Dynamics 365 F&O, maps are used to customize how the system works or to connect it with other systems. They help manage and access data in a way that’s easy to understand and use.

In short, maps in Dynamics 365 F&O are like sophisticated dictionaries for storing and finding data, making it easier to manage and use information in the system.


public static void MapUsage(Args _args)
    Map empMap = new Map(Types::Integer, Types::String);

    // Adding values to the map
    empMap.insert(1001, "Atul Yadav");
    empMap.insert(1002, "Joris");

    // Retrieving a value using a key
    info(strFmt("Employee Name: %1", empMap.lookup(1002)));

    // Iterating through the map
    MapEnumerator mapEnumerator = empMap.getEnumerator();
    while (mapEnumerator.moveNext())
        int empId = mapEnumerator.currentKey();
        str empName = mapEnumerator.currentValue();
        info(strFmt("Employee ID: %1, Name: %2", empId, empName));

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.

Saturday, November 18, 2023

Different Tier in D365

Difference between Tier 1 and Tier 2 environment Dynamics 365 FO

Tier-1 Environment:

Single-box environment

All components are installed on the same server. These components include the Application Object Server (AOS), the database, Dynamics 365 Commerce, and the Management Reporter.

Microsoft SQL Server is used.

The architecture differs from the architecture of the production environment to maximize the efficiency and cost of the development team.

The environment can be cloud-hosted, or it can be deployed as an environment image (VHD).

The environment isn't suitable for UAT or performance testing.

Tier-2 Environment:

Multi-box environment

Components are installed on multiple servers.

Azure SQL Database is used.

The architecture is the same as the architecture of the production environment, even though this type of environment has a different sizing and isn't enabled for disaster recovery.

The environment can be deployed only as a standard environment or an add-on environment. It can't be cloud-hosted.

The environment is suitable for UAT and performance testing.

Microsoft Reference:

Environment planning

Change tracking in Data Entities - DMF in Dynamics 365 FO

Change tracking in Dynamics 365 Finance & Operations (F&O) is a feature that allows you to track and synchronize data changes in specific data entities with external systems or applications. This feature is particularly useful in scenarios involving data integration or data migration. Here's a more detailed look at what change tracking entails:

Purpose: It's primarily used to ensure that external systems, such as Customer Relationship Management (CRM) systems, Business Intelligence (BI) tools, or other third-party applications, remain synchronized with Dynamics 365 F&O without the need to perform full data exports.

How It Works: When change tracking is enabled on a data entity, the system keeps track of any additions, updates, or deletions made to the records in that entity. This tracking allows external systems to only pull the changes since the last synchronization, rather than having to re-import the entire data set, saving time and resources.

Types of Tracking:
No Tracking: Change tracking is not enabled.
All: Tracks all changes made to the records of the entity.
Custom: Allows for tracking changes to specific fields within an entity.
Performance Consideration: While change tracking is a powerful feature, it's important to use it judiciously as it can have performance implications, especially when enabled on large data sets or on multiple entities.

Configuration: Change tracking is configured within the Data Management workspace. You can enable it for each data entity as per your requirements.

Usage in Data Projects: In data management projects, you can specify whether to import or export only the data that has changed since the last execution, which is particularly useful for incremental data transfers.

How to enable disable change tracking:

1. Navigate to the Data Management Workspace: The Data Management workspace is where you can manage data entities and set up the configurations for data import/export.

2. Find the Data Entities Option: Within the Data Management workspace, look for the "Data entities" option.

3. Select the Entity for Change Tracking: From the list of data entities, select the specific entity for which you want to enable change tracking.

4. Configure Change Tracking: Once you have selected a data entity, you can enable change tracking by setting the "Change tracking" option to either:

None: Change tracking is not enabled for the entity.
All: All fields in the entity are tracked for changes.
Custom: Allows for specific fields within the entity to be tracked.
Save the Configuration: After configuring the change tracking options, ensure to save the changes.


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.

Wednesday, November 15, 2023

Terminology used in PPAC as compared to LCS

Exploring the unified vision of Microsoft's One Dynamics One Platform with a focus on LCS and PPAC terminologies in Dynamics 365 F&O.

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, November 13, 2023

Difference between Owner and contributor in azure role

Owner Azure role:

    1. Full access to all resources in the Azure subscription.
    2. Can manage roles and assign permissions to others.
    3. Able to manage billing and subscription details.
    4. Can delete the subscription.
    5. Can add or remove resources and services.
    6. Has the authority to delegate responsibilities.
    7. Can set policies and compliance settings.
    8. Access to all data, including the ability to export data.

Contributor Azure role:
    1. Can manage everything except access to resources.
    2. Cannot assign roles or change permissions.
    3. Does not have access to manage billing or subscription details.
    4. Cannot delete the subscription.
    5. Can add or remove resources and services within their permissions.
    6. Operates under the permissions assigned by the Owner or other administrators.
    7. Can view but not set policies and compliance settings.
    8. Access to data within the scope of their role.

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, November 10, 2023

How to enable notifications for each and every check-in in Azure DevOps ADO

Go to Azure DevOps: ADO

Go to the project setting

Now go to notifications

Now click on the new subscription

a new pop-up will come, now click on Code(TFVC), select code is checked in 

click next

In the Deliver To select Custom email address

now in the address field, enter your email id

now in the filter criteria, field select server item

now in the operator select Under

now in value select your Repos path

TaDa !!!

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.

Wednesday, November 8, 2023

LCS Service request support issue is getting replaced by Power platform admin center help and support


Work item support issues -> submitted to Microsoft will be replaced by Power platform admin center help + Support by November 2023

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.

Difference between "Subscription" and "Premier" support plans in Microsoft Dynamics Lifecycle Services (LCS), support issues

In the context of Microsoft Dynamics Lifecycle Services (LCS), support issues can be managed at different levels, typically categorized under "Subscription" and "Premier" support plans. Here's a general overview of the differences:

Subscription Support:

This is the standard support that comes with your Dynamics 365 subscription.

It includes access to self-help resources, Microsoft's knowledge base, and community forums.

You can submit support tickets for technical issues.

The response times can be longer compared to Premier support.

It's suited for less critical issues that don't require immediate attention.

Premier Support:

Premier support is a higher level of support service that Microsoft offers for an additional fee.

It provides everything in the Subscription support, plus a range of additional benefits.

These benefits often include 24/7 support for critical issues, faster response times, and direct access to Microsoft's top engineers.

You might also have an assigned support account manager who understands your business and technology environment.

This plan is tailored for organizations that need immediate assistance with critical issues or who want a more proactive support experience.

Enterprises choose Premier support when they require a more dedicated and immediate support experience, especially for mission-critical operations where downtime can be very costly. Subscription support may suffice for more routine issues and for businesses with less critical reliance on immediate issue resolution.

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 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.


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


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


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



    // Insert the records into the database


    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


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.


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:



DBCC SHRINKFILE (AXdb277_log, 1);


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.

Tuesday, August 22, 2023

Create access token from c sharp code and get it in dynamics 365 FO

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;

namespace AY_AccessToken
    public class ClassAccessToken
        private static string clientId = "2539b54-0891-4aad-99a6";
        private static string clientSecret = "H18Q~DntOA9aQX";
        private static string resource = "";
        private static HttpClient httpClient = new HttpClient();

        public static string GetAccessToken()
            var content = new StringContent($"grant_type=client_credentials&client_id={clientId}&client_secret={clientSecret}&resource={resource}");
            content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/x-www-form-urlencoded");
            var response = httpClient.PostAsync("", content).GetAwaiter().GetResult();
            var result = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
            string accessToken = result.Split(':')[1].Split(',')[0].Replace("\"", "");

            string search = "\"access_token\":\"";
            int start = result.IndexOf(search) + search.Length;
            int end = result.IndexOf("\"", start);
            string accessTokenFinal = result.Substring(start, end - start);
            return accessTokenFinal;

Dynamics 365 F&O code to get the token:

using AY_AccessToken;
internal final class RunnableClass1
    public static void main(Args _args)
        str accessToken;
        accessToken = ClassAccessToken::GetAccessToken();

Friday, August 11, 2023

Aggregate dimensions and aggregate measurements in Dynamics 365 FO

Aggregate dimensions and aggregate measurements in Dynamics 365 Finance and Operations (F&O) are components used within reporting and analytics.

Aggregate Dimensions: These are attributes or characteristics that allow data to be categorized and grouped. They are typically used to filter or slice data within reports. For example, an aggregate dimension might be a product category, region, or salesperson. By using these dimensions, you can summarize and analyze data in a way that makes sense for your organization.

Aggregate Measurements: These refer to the actual data values that are being summarized and analyzed. Aggregate measurements include things like total sales, quantity sold, or profit margins. They are typically used in conjunction with aggregate dimensions to provide a comprehensive view of the data. Aggregate measurements can be viewed in various summaries such as sums, averages, counts, etc.

In Dynamics 365 F&O, both components play an essential role in creating powerful and insightful reports. Aggregate dimensions provide the framework for viewing data, while aggregate measurements provide the actual content being analyzed. Together, they enable users to tailor reports and analytics to meet specific business needs and objectives.

Youtube video : Link

Entity store : Link

BYOD : Link

CloudFronts : Link

Efficient Data Reporting and Analysis : Link

Wednesday, August 9, 2023

Enqueue and Dequeue in Dynamics 365 FO


Sending data from another system to Dynamics 365 F&O. When data needs to be transferred to Dynamics 365 F&O, it's placed into a queue (enqueued), awaiting processing within the Dynamics system.


Sending data from Dynamics 365 F&O to another system. After the data has been processed within Dynamics 365 F&O, it can be removed from the queue (dequeued) and sent to another system as needed.

So in summary:

Enqueue is related to receiving data into Dynamics 365 F&O.

Dequeue is related to sending data from Dynamics 365 F&O to another system.

Link to understand Enqueue and Dequeue

Tuesday, August 8, 2023

How to create a logic app in azure to move files in SFP from one folder to another

Go to Azure portal : Azure

You will see window like below

Click on "Create a resource"

A new window will open, there search for "Logic apps", as shown below

Now new window will come like below, select create > Logic App

Now new window will come like below

Enter the resource group, logic app name, select the region, select the plan type as consumption

Now click next > Next, you will see a window like below

Click on create

Deployment will take some time, now go to the resource
The moment you will go to resource, Logic app designer will be opened automatically like below

Go downwards and click on 'Blank logic app'

Logic app designer will open like below

Search for appropriate triggers, in my case I will be searching for "Recurrence"
Select the icon shown below

after that select Recurrence again as shown below

New window will open like below

Set in the parameters acc to your need, I will be setting Once a day
Now click on Next step, a window will open like below, where you can select actions

Now select variables, and select in "Initialize variable" like below

Now fill in the name of the variable and type like shown below

Now you may rename the action as well, as shown below

Now do the same for "To path" variable as shown below

Now add an action and 'SFTP' and select 'List files in folder', as shown below

you will see something like below

In my case I have already setup the SFP connection, but you can also setup like below

Fill in the connection name, host server address, username and password (click on disable SSH host key validation) if you are using username and password

Now save the connection and make it as default

Now click on the Folder, a lookup will come like below

Selected 'From path' from the variables, final should look like below

Now click on, New step and  search for 'For each' in control

Now select the 'body', as shown below

Rename the 'For each' to 'Move to each file' and Now the logic app should look like below

Now select an action inside the loop, now search for condition and select like shown below

Now condition action will be added, there you can select Name in the condition as shown below

expression should look like below

Now in the true side, search for SFTP and select "Copy file" as shown below

Now the copy file action should look like below

the 1st expression in the Destination file path is utcNow('yyyy')
and the 2nd expression in the Destination file path is utcNow('MM')

Now below that action add an action 'Delete file' as shown below

Now configure the Delete file action like below