Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

How to call "Import in batch" in DMF functionality through X++ code?

(0) ShareShare
ReportReport
Posted on by 355

Hye ,

User wants to import customers through batch a custom form with excel file browsing option. It can be done through IMPORT in BATCH in DMF but user will not use DMF so wants to trigger "Import in batch" through code.

How can we do that??

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Hi D365FO Avatar,

    Depends on what do you mean by "read excel file in batch".

    Do you mean you want the user to give the ability to select the file in the dialog and run import in batch? This scenario is possible as you need to upload the file anyway to blob storage, so you just need to pack blob storage file identifier before the batch job is scheduled and use it later when the batch is processed.

    If you mean reading a file from some local folder in batch, it's not possible.

  • D365FO Avatar Profile Picture
    D365FO Avatar 355 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Now what I'm thinking to create a sysOperation framework class and read the excel file and upload it in target table.

    We can read the excel file in Batch class??

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Hi D365FO Avatar,

    In this case, you can copy-paste needed parts from existing classes to your class. Bank account import statement can be over-complicated from this perspective, but you can find other examples by using cross-reference for DMFQuickImportExport.doPGImport method.

    For example, TaxImportInvoiceTaxIntegration_CN class looks quite simple and you can just copy-paste it and change code a bit to works with a different entity.

  • D365FO Avatar Profile Picture
    D365FO Avatar 355 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    I want to have a dialog form which have a browsing option where user will upload the Excel file and by OK button click this excel file data should be imported in Staging table through batch process.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Hi D365FO Avatar,

    Not sure what method you are looking for. Do you want to have one method which will get the file as an input parameter and do DMF import with?

    In general, you still need to do mandatory steps:

    1. Upload a file to blob storage and get file id

    2. Prepare execution

    3. Run doPGImport

  • D365FO Avatar Profile Picture
    D365FO Avatar 355 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Hi,

    I saw that method and found there are many classes used in it.

    as Like Import we can use the below code directly. So likewise there is class DMFBatchImporter is called while "Import in batch" calling.

     DMFQuickImportExport::doPGImport(_dmfDefinitionGroup.DefinitionGroupName, _executionId, true, true );

    So there is anything like that or any method in this class??

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: How to call "Import in batch" in DMF functionality through X++ code?

    Hi D365FO_Avatar,

    Bank account statement import is using DMF import to import file selected by the user in the dialog.

    Check class BankStatementImportBatch and method doImportBankStatementsDMF for code sample

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans