How to create C# Library and Use with in Dynamics 365 For Finance and Operation

Some time we need to Integrate external business logic or third-party functionality into a Dynamics 365 project often involves creating a C# class library. In this library, you'll typically write methods that encapsulate the desired business logic or functionality. These methods can then be referenced and called within your Dynamics 365 project.

Step-1: open visual studio and create “D365Project”.For creating new project in D365 Open visual   studio à File à New à Project à select Finance and operation à click Ok. After creating the project visual studio will look like this.


Step-2: Secondly Add new Csharp Library project in the same Solution. I added “CsharpProject”. For adding right click on SolutionàAddàNew Project.

Step-3:  Now in the next window on the lift panel Select Visual C# à Class library àOk.


Step-4: After adding the above step now you can see in the Solution Explorer there is 2 projects. One of  the CsharpProject and second is the D365Project.


Step-5: Rename the by default name from class1 to a meaningful name. I renamed it “CsharpClassLibrary.cs” and write the business logic. I am writing just one method for demonstration.


Step-6: Now add Reference the project. For reference Right click on the D365Project à add àreference

Step-7: In this window select your project if there are multiple project and click on the OK button to add the reference to the project.

Step-8: now verify the reference under the Reference node.

Step-9: Add runnable class in D365Project and write X++ code to get Csharp Library. Set runnable class as Startup object. Build and run the project.

Step-10: after successfully run the Runnable class you can see the Info log on the screen.


Step-11: finally you can check the Customer name should be change in the D365.



That’s it, thanks for reading…

Comments

Popular posts from this blog

How to Extract and generate a CSV File and Retrieve a List of Project Addresses in AX 2012 Using SQL and X++

Extracting Project Addresses to Excel in Dynamics AX 2012