Import General Journal Lines using SysOperation Framework in AX 2012

Hi Guys,


Today, I am going to share my experience of Importing General Journal Lines using SysOperation Framework in AX 2012.

Some time before a task was assigned to me to import General Journal lines considering all the standard functionality used while creating General Journal line manually from front end in AX 2012.
i.e.
1. Account Types
2. Dimensions
3. Voucher generation
4. VAT
5. All mandatory fields


Coming to the solution. I have created the required functionality. I am sharing the code snippet for the functionality below:


















In above screen, you can see the dialog for Import Journal Lines

There are three fields in the dialog:

1. File name (Excel template is required to browse from directory)
2. Journal name (Journal name needs to be selected from lookup of available journal names)
3. Offset account (Offset account check-box is placed to represent either the lines will balance with Offset account or not)

Scenario 1:

In scenario 1, I am going to select a Excel template without Offset account by not checking the Offset account field in dialog.




















In above screen, you can see the one journal is created with two lines balancing the voucher and keeping voucher number same for both lines. In this case Offset account is not provided.

The voucher is same for both the lines, because we have set the Journal name setting of Voucher number property:







Scenario 2:

In scenario 1, I am going to select a Excel template with Offset account by checking the Offset account field in dialog.


























Now, I have selected Excel template with Offset accounts on lines and also marked Offset account checked.


















Multiple lines have been imported in this Journal with different Voucher number for every line. It is because voucher is being balanced by Offset account provided in the excel template.


Now, I am going to share the code snippet with you guys in several screens below:

Contract class:



















UIBuilder Class:


















In above screen, I have registered the lookup method for Journal names and also bind the Offset account check-box field.

Controller Class:

Controller class is the main class which doing the functionality logic thing.
Please, refer the screens below:

















































































































































Service Class:


















Menu Item Properties:

























If you compile all the codes snippets, you'll be able to get this functionality executable.


Thanks for your time and interest.


The capacity to learn is a gift, the ability to learn is a skill, the willingness to learn is a choice.


Brian Herbet



Comments

Popular posts from this blog

Mobile Development with Microsoft Technology (Xamarin) Part - 1

Purchase Order Chat-bot application with OData endpoints using WebApi in D365 for Operations