As you all already aware of , we can use features like data management , open in excel to import data in dynamics 365 for operations. Open is excel feature is widely used for importing data in general Journals and other areas. However for larger set of data its little bit time consuming. So requirement came to me that we don’t want to provide full access to data management workspace to users but we need ability to import data from general Journal screen itself using data entities, open in excel feature uses data entities as well but importing data directly from data entity its much faster compared to using open in excel feature. You can use standard security architecture to give restrictive access to data management workspace to users but here is another way to execute data entities by directly clicking button from general Journal screen which redirects to data management import screen with just particular entity added.

This is very good option with minimum code as compared to earlier version , in earlier versions sometimes we write custom classes just to import data from excel , CSV etc.

You can create extension to form LedgerJournaltable form and add a button to import data from excel ,csv etc.. In my scenario I took an example of importing from excel .

You can see in below image I added button “Import lines” .


Once you click this Button it takes to import screen in data management as shown below where user can add file using add file button and click on Import to import journal Lines. When this screen is open after clicking on button , system gives message about generating mapping you can click no at this time as when we upload file its going to generate mapping again. As you can see in the image below everything is prepopulated on this screen like definition group name , entity name , file format etc.


Click on add file button and upload file , system will ask you for overwriting existing entity and generation mapping, click yes both the times. To generate excel template you can simply create excel export project and download package, which will give you excel template which we can use in Import process.


Once you upload file and generate mapping successfully click on Import button at the top of screen. As you can see in the screenshot below, once job is finished Journal lines get uploaded in the journal.


Below is the code I used to open import screen from General Journal.

I just copied onclicked eventhandler for that button and implemented it in my extension class as below

[FormControlEventHandler(formControlStr(LedgerJournalTable, caaImportLines), FormControlEventType::Clicked)]
    public static void caaImportLines_OnClicked(FormControl sender, FormControlEventArgs e)
        DMFDefinitionGroup  DMFDefinitinGroup;
        TAParameters        TAParameters = caaTAParameters::find();

        select firstonly DMFDefinitinGroup where DMFDefinitinGroup.DefinitionGroupName == caaTAParameters.GLImportDefinitionGroup;
        DMFEntity dmfEntity;
        Args args = new Args();
        FormRun formRun;
        formRun = classfactory.formRunClass(args);

        select firstonly EntityName from dmfEntity
                    where dmfEntity.TargetEntity == tableId2Name(tableNum(ExpenseJournalLineEntity));
        FormCheckBoxControl             entityTruncateData = formRun.control(formRun.controlId('DMFDefinitionGroup_TruncateEntityData')) as FormCheckBoxControl;
        FormDropDialogButtonControl     AddEntity = formRun.control(formRun.controlId('AddEntity')) as FormDropDialogButtonControl;
        FormDropDialogButtonControl     AddMultiple = formRun.control(formRun.controlId('AddMultiple')) as FormDropDialogButtonControl;
        FormDropDialogButtonControl     AddTemplate = formRun.control(formRun.controlId('AddTemplate')) as FormDropDialogButtonControl;
        FormCommandButtonControl        RemoveEntity = formRun.control(formRun.controlId('RemoveEntity')) as FormCommandButtonControl;
        FormControl                     standardView ='StandardView')) as FormControl;
        FormControl                     openinExcel ='OpenEntityInExcel')) as FormControl;
        FormFunctionButtonControl       DefinitionGroupAccess ='DefinitionGroupAccess')) as FormFunctionButtonControl;
        FormFunctionButtonControl       DefinitionGroupDataArea ='DefinitionGroupDataArea')) as FormFunctionButtonControl;
        FormFunctionButtonControl       DownloadPackage ='DownloadPackage')) as FormFunctionButtonControl;
        FormFunctionButtonControl       RecurringDataJob ='RecurringDataJob')) as FormFunctionButtonControl;

        FormCommandButtonControl        newButton = as FormCommandButtonControl;
        FormCommandButtonControl        deleteButton = as FormCommandButtonControl;




As you can see in the above code I am just calling DMFQuickImportExportEnhanced form through code with operation type as Import . I have hardcoded name of the Definition group here but you can parametrized it. Entity to import data can be selected from DMFEntity table . You can use LedgerJournalEntity or ExpenseJournalLineEntity . In my case I used ExpenseJournalLineEntity.

I am disabling the extra button controls like remove entity , add entity from users as I don’t want to give them ability to do any changes on this screen, you can use Standard security to disable these buttons as well. I felt doing this in a code is also not time consuming.

Not exactly similar but close to this functionality is exist in expense module wherein they create new definition group every time you click on import credit card transaction button, I don’t want user to create new import project every time they click this button so kept that project as a parameter. This helps in avoiding unnecessary data projects and they can see job history from their previous runs in a single project.