RSS

Load context-sensitive Power BI tiles in Dynamics 365 Finance via Power Apps

Load context-sensitive Power BI tiles in Dynamics 365 Finance via Power Apps

ErpCoder

Power BI goes hand in hand with Dynamics 365 Finance and Supply Chain Management. By default Power BI can be used within workspaces and Dynamics 365 comes with a data warehouse and a large set of reports and dashboards. But wouldn’t it be nice to show Power BI visuals in common forms and filter on the active record? This can be done without coding by using Power Apps:

D365 Parameter to Power BI filter

Dynamics 365 Finance is capable to load Power Apps and pass parameters to the App, while Power Apps can load PowerBI reports and pass a filter to Power BI.

Create a Power BI report

Create a report that can be drilled down to the granularity you want to display in Dynamics 365 Finance. For example if you want to show customer specific information, your report should support filtering on a customer account.

For example I’m using…

View original post 545 more words

 
Leave a comment

Posted by on December 9, 2020 in Uncategorized

 

Automatically stop/start AX Azure VMs


coderscove

(Updated 3/12/2017: Fixed issue in script – code updated below)
As you probably know, AX7 (or as it is called now ‘Microsoft Dynamics 365 for Operations’ – rolls off the tongue so nice!), is hosted on Azure.

We currently also have an AX2012R3 instance running on Azure.

With Azure, you are pretty much billed by the hour. If your VM is running, then you are paying. So it makes sense to shut down the VM’s on off-hours.

In Azure you can use PowerShell scripts to automate things like this. You run these scripts through the ‘Runbook’ option in the Azure portal.

So I decided to spend some time on getting this to work. I don’t have much experience with Azure, so I used the great, all knowing World Wide Web for a little help.

This post was instrumental on getting started:

Azure is very much in development, much like…

View original post 751 more words

 
Leave a comment

Posted by on November 3, 2020 in Uncategorized

 

Read File’s from SFTP Server and Write data in AX365 (PART 1)


In Part 1, will create a project with basic SFTP functionality which we will use in AX in Part 2

Basic Step is to add the Parameters to set the SFTP details.

Tips:

If we are using Port 22 then no need to use a prefix of SFTP in your Host because 21 is for FTP and 22 is for SFTP

Your File path should start from the directory root folder not from the SFTP server name.

To connect to the SFTP Server. I used SSH.NET Dll.

Create a New C# Library project, Right Click on your project, click on Manage NuGet Packages and Install ssh.net In your project. It will add a reference of DLL into your project.

Add a reference of this dll in your class

using Renci.SshNet;

Now we need to write a method to make a connection,

1
2
3
4
5
6
7
8
9
10
11
12
13
public SftpClient OpenSFTPConnection(string host, int port, string username, string password)
{
    if (this.sftpClient == null)
    {
        this.sftpClient = new Renci.SshNet.SftpClient(host, port,      username, password);
    }
   if (!this.sftpClient.IsConnected)
    {
        this.sftpClient.Connect();
    }
    return this.sftpClient;
}

This method will return all the files present in the directory

1
2
3
4
public List<string> GetDirectories(SftpClient _SftpClient, string path)
{
        return _SftpClient.ListDirectory(path)/*.Where(n => n.IsDirectory).ToList();
}

This method will return the stream which we can use to read the content of the files.

public Stream DownloadFile(SftpClient _SftpClient, string sourcePath)
 {
        var memoryStream = new MemoryStream();
        _SftpClient.DownloadFile(sourcePath, memoryStream);
        memoryStream.Position = 0;
        return memoryStream;
}

I also got a requirement to move files to a different folder after writing data in AX. Below method will do that magic.

1
2
3
4
public void MoveFile(SftpClient _SftpClient, string sourcePath, string destinationPath, bool isPosix)
{
        _SftpClient.RenameFile(sourcePath, destinationPath, isPosix);
}

Final Code for our library project will look like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Renci.SshNet;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySshNet
{
    public class sftpConnection
    {
        public SftpClient sftpClient;
        public SftpClient OpenSFTPConnection(string host, int port, string username, string password)
        {
            if (this.sftpClient == null)
            {
                this.sftpClient = new Renci.SshNet.SftpClient(host, port, username, password);
            }
            if (!this.sftpClient.IsConnected)
            {
                this.sftpClient.Connect();
            }
            return this.sftpClient;
        }
        public List<string> GetDirectories(SftpClient _SftpClient, string path)
        {
            return _SftpClient.ListDirectory(path)/*.Where(n => n.IsDirectory)*/.Select(n => n.Name).ToList();
        }
        public void MoveFile(SftpClient _SftpClient, string sourcePath, string destinationPath, bool isPosix)
        {
            _SftpClient.RenameFile(sourcePath, destinationPath, isPosix);
        }
        public Stream DownloadFile(SftpClient _SftpClient, string sourcePath)
        {
            var memoryStream = new MemoryStream();
            _SftpClient.DownloadFile(sourcePath, memoryStream);
            memoryStream.Position = 0;
            return memoryStream;
        }
    }
}

Now Just build your project then go to your projects bin\Debug folder and copy both Dll’s. paste the DLL’s to your AX extension Bin Folder so we can use it in our AX project.

Tips:

We need to add our Dll’s in our extension Bin folder so It can go through with check in to the next environments.

Reference: https://dynamicsax4u.wordpress.com/2020/08/18/read-files-from-sftp-server-and-write-data-in-ax365-part-1/?blogsub=confirming&blogsub=confirming#subscribe-blog

 
Leave a comment

Posted by on August 23, 2020 in D365, Uncategorized

 

Tags:

HcmPositionHirarchy To whom position needs to report in upper ranking in D365 FinOps


static void AlfPositionHirarchyUP(Args _args)
{
HcmWorker                   HcmWorker;
HcmPositionWorkerAssignment HcmPositionWorkerAssignment;
HcmPositionHierarchy        HcmPositionHierarchy;
HcmPositionRecId            positionRecId;

positionRecId = HcmPosition::findByPosition(HcmWorker::      findByPersonnelNumber(‘701027’).primaryPositionId()).RecId;

while(positionRecId>0)
{
select * from HcmPositionHierarchy
where HcmPositionHierarchy.Position ==positionRecId;

positionRecId=HcmPositionHierarchy.ParentPosition ;
if(HcmPositionHierarchy.ParentPosition)
{
info(HcmWorker::find(HcmPosition::getReportsToWorker(HcmPositionHierarchy.Position)).name());
}
}

}

 
Leave a comment

Posted by on July 13, 2020 in HRM, Uncategorized

 

Get Schedule Batch job date and time


/// <summary>
/// Gets the scheduled date and time of job.
/// </summary>
/// <returns>
/// Scheduled date and time of job.
/// </returns>
public UtcDatetime scheduledDateTime()
{
BatchJob batchJob;

select firstonly OrigStartDateTime from batchJob
where batchJob.RecId == BatchHeader::getCurrentBatchTask().BatchJobId ;

return batchJob.OrigStartDateTime;
}

 
Leave a comment

Posted by on July 13, 2020 in Batch jobs

 

Tags:

Create Azure Connector for Lifecycle Services


 how to set up the Azure connection required for Dynamics 365 For Finance and Operations Deploy through Lifecycle Services. First of all, we open our project from Lifecycle Services. Under Environments, we click on Microsoft Azure settings.

Your Azure Connectors will appear on the Azure connectors tab, if available. It appears on the list because I have a connection for this environment. After completing these steps, when we look, here again, the connection must be established. We can start adding a new link by clicking the + Add button.


 

In the window that opens, Name will be the name we provide for the link. Azure subscription ID we want to establish a connection to the section Azure, you must enter the code for the membership. Tenant Domain information will come automatically. You should mark Azure Resource Manager (ARM) as
Yes. We go to the next page with Next.


 

You should have given the Dynamics Deployment Services authorization I mentioned in my previous article before this step. If you have, you will see the screen below. We go to the next page with Next.


 

Before continuing, we need to download the Management certificate and install it on the Microsoft Azure Portal. You can leave this page open.


 

We login to the Azure portal and select the membership you want to connect with.


 

We click on the Management Certificates section and click the Upload button in the window that opens.


 

We select and upload the certificate we downloaded.


 

When you see this screen, the installation process is completed.


 

We can return to the screen we stayed in Lifecycle Services and continue with the Next button. After this stage, we can continue without errors.

 

We usually choose West Europe in the Azure region.

 

After clicking the Connect button, you should see an item in your Azure Connection list as follows. At this stage, the connection has been completed.


 

In this article, I tried to explain how to set up an Azure connection via Lifecycle ServicesSince Dynamics 365 is a structure that runs on Azure, it is necessary to have information about many Azure subjects.

 

 
Leave a comment

Posted by on July 6, 2020 in LCS, Uncategorized

 

Tags:

Electronic reporting by example: Create a new Bank file definition


Thomas Widmer's D365 Blog

Electronic Reporting seems to be an integral part of the future of Dynamics 365 that can be used for importing and exporting data of all kinds above and beyond the capabilities of the static data entities, so it is worth finding out how this works.
In the following we will do this by example.

Online ressources

As a starting point there is standard microsoft documentation and this great blog with detaillied instructions:

High level overview for creation of new Bank file

  1. Extend a preexisting bank format
  2. Define new export format – Constants
  3. Define new export format – Data fields
  4. Add transformations for correct formatting
  5. Add new calculated fields
  6. Calculate total fields
  7. Add user input parameters
  8. Add validations for readable errors
  9. Activate

BACS: 1. Extend a preexisting bank format

It is always easier to start based on preexisting work instead of starting from scratch, so to create a new…

View original post 277 more words

 
Leave a comment

Posted by on February 17, 2020 in Uncategorized

 

Filter product dimensions

Filter product dimensions

Dynamics Ax

Sometimes it’s necessary to filter an inventDim record and only get the active product dimensions. This can be useful if you, for example, define additional data for an item and its product dimensions and have to call this data in a sales order line where the associated inventDim record also contains storage dimensions like site and warehouse.

In this case you want to strip out the unwanted dimensions from the inventDim record which you can do by using following code:

2020-02-01 15_07_36-InventDim _ InventDim filtern _ Produktdimensionen - OneNote

Basically you define a new inventDim buffer, transfer the data from your current inventDim record and find the active dimensions for the specific item. After that is done you can clear all dimensions which are not active and search for the correct inventDim record.

View original post

 
Leave a comment

Posted by on February 17, 2020 in Uncategorized

 

Query-join

Query-join

Dynamics Ax

This is a small code snippet which shows off an example of a join within a query.

inkedqueryjoin_li1

You can join as many tables as you would like. In this example i joined the table “EcoResColor” and “EcoResProductMasterColor”.

View original post

 
Leave a comment

Posted by on February 17, 2020 in Uncategorized

 

Call a filtered form with x++

Call a filtered form with x++

Really nice want to reblog it on my blog

Dynamics Ax

If you want to call a form which is prefiltered you have multiple options to do so.

You can of couse use a menu item but you can also achieve this with code.

In this example we want to show all contacts which are connected to the selected customer on the address form. The idea is to create a button and call the contact form prefiltered with the current customer.

First of all you need a button on your form which is your entry point to the logic behind it. Ideally this is an unbound button-control without fancy details other than a label.

ButtonForm

The actual logic is placed in an eventhandler. Best bet is to subscribe to the clicked-event.

ButtonLogic.png

As you can see the logic itself is quite simple. We get the current dirPartyTable record with the dirPartyLocation, pass it to args and call the menu item of the contacts…

View original post 17 more words

 
Leave a comment

Posted by on February 17, 2020 in Uncategorized

 
 
GM Dynamics Blogs

Transform IT with Digital Trasformation and Social Innovation

Ms. Dynamic Millennial

Unboxing Microsoft Dynamics 365 for Finance and Operations

DynaD365Power

Exploring the new vision of the Power platform

Dynamics Vision 365

The FinOps pulse

Breaking Bong

I write when no one is watching

ErpCoder

Microsoft Dynamics 365 Business Management Solution Enthusiast

Dynamics 365 Finance

Dynamics 365 Finance & Much More.

Microsoft Dynamics AX

“ANYONE WHO STOPS LEARNING IS OLD, WHETHER AT TWENTY OR EIGHTY.” —HENRY FORD

axhowto

Blog about ax with sample codes, tips and tricks.

Sumit Potbhare

Dynamics 365 for Commerce

iotsolution.se

This is your site about D365 (Finance and Supply Chain Management), IoT (Internet of Things) and HoloLens

Omni 365

Dynamics 365 Finance and Operations Blog

DIY D365

Power Platform Done Your Way

Azure Integration for Dynamics 365

Azure Integration for Dynamics 365 Unified Operations, Logic Apps, Azure Functions, REST