504 lines
No EOL
57 KiB
HTML
504 lines
No EOL
57 KiB
HTML
<!doctype html><html lang=en class="js csstransforms3d">
|
|
<head>
|
|
<meta charset=utf-8>
|
|
<meta name=viewport content="width=device-width,initial-scale=1">
|
|
<meta name=generator content="Hugo 0.89.2">
|
|
<meta name=description content>
|
|
<title>Data Migration Facade :: BC AL Help</title>
|
|
<link href=/css/nucleus.css?1636530359 rel=stylesheet>
|
|
<link href=/css/fontawesome-all.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/featherlight.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/perfect-scrollbar.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/auto-complete.css?1636530359 rel=stylesheet>
|
|
<link href=/css/theme.css?1636530359 rel=stylesheet>
|
|
<link href=/css/theme-blue.css?1636530359 rel=stylesheet>
|
|
<link href=/css/variant.css?1636530359 rel=stylesheet>
|
|
<link href=/css/print.css?1636530359 rel=stylesheet media=print>
|
|
<script src=/js/jquery.min.js?1636530359></script>
|
|
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
|
|
</head>
|
|
<body data-url=/navpatterns/1-patterns/data-migration-facade/>
|
|
<script>var index_url="/index.json",root_url="/",baseUri=root_url.replace(/\/$/,'')</script>
|
|
<nav id=sidebar>
|
|
<div id=header-wrapper>
|
|
<div id=header>
|
|
<a id=logo href=/ style="color:#f5f5f5;font-family:novacento sans wide,helvetica,tahoma,geneva,arial,sans-serif;font-size:30px;font-weight:700;margin-top:-2px">
|
|
BC AL Help . dev
|
|
</a>
|
|
<i style=color:#f5f5f5>Code is Poetry</i>
|
|
</div>
|
|
<div class=searchbox>
|
|
<label for=search-by><i class="fas fa-search"></i></label>
|
|
<input data-search-input id=search-by type=search placeholder=Search...>
|
|
<span data-search-clear><i class="fas fa-times"></i></span>
|
|
</div>
|
|
<script src=/js/lunr.min.js?1636530359></script>
|
|
<script src=/js/auto-complete.js?1636530359></script>
|
|
<script src=/js/search.js?1636530359></script>
|
|
</div>
|
|
<div class=highlightable>
|
|
<ul class=topics>
|
|
<li data-nav-id=/welcome/ title=Welcome class=dd-item><a href=/welcome/><b><i class="fas fa-home"></i> </b>Welcome</a><ul></ul></li>
|
|
<li data-nav-id=/bcpatterns/ title="BC Patterns" class=dd-item><a href=/bcpatterns/><b><i class="fas fa-clone"></i> </b>BC Patterns</a><ul></ul></li>
|
|
<li data-nav-id=/bcbestpractices/ title="BC Dev. Best Practices" class=dd-item><a href=/bcbestpractices/><b><i class="fas fa-medal"></i> </b>BC Dev. Best Practices</a><ul></ul></li>
|
|
<li data-nav-id=/navpatterns/ title="NAV Patterns Archive" class="dd-item parent"><a href=/navpatterns/><b><i class="fas fa-save"></i> </b>NAV Patterns Archive</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/ title="1. Patterns" class="dd-item parent"><a href=/navpatterns/1-patterns/>1. Patterns</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/activity-log/ title="Activity Logs" class=dd-item><a href=/navpatterns/1-patterns/activity-log/>Activity Logs</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/argument-table/ title="Argument Table" class=dd-item><a href=/navpatterns/1-patterns/argument-table/>Argument Table</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/blocked-entity/ title="Blocked Entity" class=dd-item><a href=/navpatterns/1-patterns/blocked-entity/>Blocked Entity</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/blocked-entity/data-driven-blocked-entity/ title="Data Driven Blocked Entity" class=dd-item><a href=/navpatterns/1-patterns/blocked-entity/data-driven-blocked-entity/>Data Driven Blocked Entity</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/cached-web-service-calls/ title="Cached Web Server Calls" class=dd-item><a href=/navpatterns/1-patterns/cached-web-service-calls/>Cached Web Server Calls</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/conditional-cascading-update/ title="Conditional Cascading Update" class=dd-item><a href=/navpatterns/1-patterns/conditional-cascading-update/>Conditional Cascading Update</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/copy-document/ title="Copy Document" class=dd-item><a href=/navpatterns/1-patterns/copy-document/>Copy Document</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/create-data-from-templates/ title="Create Data from Templates" class=dd-item><a href=/navpatterns/1-patterns/create-data-from-templates/>Create Data from Templates</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/create-urls-to-nav-clients/ title="Create URLs to NAV Clients" class=dd-item><a href=/navpatterns/1-patterns/create-urls-to-nav-clients/>Create URLs to NAV Clients</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/creating-custom-charts/ title="Creating Custom Charts" class=dd-item><a href=/navpatterns/1-patterns/creating-custom-charts/>Creating Custom Charts</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/cross-session-events/ title="Cross Session Events" class=dd-item><a href=/navpatterns/1-patterns/cross-session-events/>Cross Session Events</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/currently-active-record/ title="Currently Active Record" class=dd-item><a href=/navpatterns/1-patterns/currently-active-record/>Currently Active Record</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/data-migration-facade/ title="Data Migration Facade" class="dd-item active"><a href=/navpatterns/1-patterns/data-migration-facade/>Data Migration Facade</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/discovery-event/ title="Discovery Event" class=dd-item><a href=/navpatterns/1-patterns/discovery-event/>Discovery Event</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/document/ title=Document class=dd-item><a href=/navpatterns/1-patterns/document/>Document</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/ title="Easy Update Of Setup Or Supplementary Information" class=dd-item><a href=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/>Easy Update Of Setup Or Supplementary Information</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/error-message-processing/ title="Error Message Processing" class=dd-item><a href=/navpatterns/1-patterns/error-message-processing/>Error Message Processing</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/extending-the-role-center-headlines/ title="Extending the Role Center Headlines" class=dd-item><a href=/navpatterns/1-patterns/extending-the-role-center-headlines/>Extending the Role Center Headlines</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/feature-localization-for-data-structures/ title="Feature Localization For Data Structures" class=dd-item><a href=/navpatterns/1-patterns/feature-localization-for-data-structures/>Feature Localization For Data Structures</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/hooks/ title=Hooks class=dd-item><a href=/navpatterns/1-patterns/hooks/>Hooks</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/ title="Surrogate keys using Autoincrement Pattern" class=dd-item><a href=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/>Surrogate keys using Autoincrement Pattern</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/instructions-in-the-ui/ title="Instructions in the UI" class=dd-item><a href=/navpatterns/1-patterns/instructions-in-the-ui/>Instructions in the UI</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/integration-of-addresses/ title="Integration of Addresses" class=dd-item><a href=/navpatterns/1-patterns/integration-of-addresses/>Integration of Addresses</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/journal-error-processing/ title="Journal Error Processing" class=dd-item><a href=/navpatterns/1-patterns/journal-error-processing/>Journal Error Processing</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/journal-template-batch-line/ title="Journal Template Batch Line" class=dd-item><a href=/navpatterns/1-patterns/journal-template-batch-line/>Journal Template Batch Line</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/master-data/ title="Master Data" class=dd-item><a href=/navpatterns/1-patterns/master-data/>Master Data</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multi-file-download/ title="Multi-file Download" class=dd-item><a href=/navpatterns/1-patterns/multi-file-download/>Multi-file Download</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multi-page-list/ title="Multi-Page List" class=dd-item><a href=/navpatterns/1-patterns/multi-page-list/>Multi-Page List</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multilanguage-application-data/ title="Multilanguage Application Data" class=dd-item><a href=/navpatterns/1-patterns/multilanguage-application-data/>Multilanguage Application Data</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/net-exception-handling-in-cal/ title="NET Exception Handling in CAL" class=dd-item><a href=/navpatterns/1-patterns/net-exception-handling-in-cal/>NET Exception Handling in CAL</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/ title="TryFunction NET Exception Handling in CAL" class=dd-item><a href=/navpatterns/1-patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/>TryFunction NET Exception Handling in CAL</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/no-series/ title="No Series" class=dd-item><a href=/navpatterns/1-patterns/no-series/>No Series</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/ title=Notifications class=dd-item><a href=/navpatterns/1-patterns/notifications/>Notifications</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/in-context-notifications/ title="In-context Notifications" class=dd-item><a href=/navpatterns/1-patterns/notifications/in-context-notifications/>In-context Notifications</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/notification-lifecycle-management-pattern/ title="Notification Lifecycle Management Pattern" class=dd-item><a href=/navpatterns/1-patterns/notifications/notification-lifecycle-management-pattern/>Notification Lifecycle Management Pattern</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/observer/ title=Observer class=dd-item><a href=/navpatterns/1-patterns/observer/>Observer</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/posting-routine-select-behavior/ title="Posting Routine - Select Behavior" class=dd-item><a href=/navpatterns/1-patterns/posting-routine-select-behavior/>Posting Routine - Select Behavior</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/product-name/ title="Product Name" class=dd-item><a href=/navpatterns/1-patterns/product-name/>Product Name</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/ title=Queries class=dd-item><a href=/navpatterns/1-patterns/queries/>Queries</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/select-distinct-with-queries/ title="SELECT DISTINCT with Queries" class=dd-item><a href=/navpatterns/1-patterns/queries/select-distinct-with-queries/>SELECT DISTINCT with Queries</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/ title="use Queries to Detect Duplicate Records" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/>use Queries to Detect Duplicate Records</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/ title="Use Queries to Replace Nested Loops" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/>Use Queries to Replace Nested Loops</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/read-once-initialization-and-validation/ title="Read-once Initialization and Validation" class=dd-item><a href=/navpatterns/1-patterns/read-once-initialization-and-validation/>Read-once Initialization and Validation</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/released-entity/ title="Released Entity" class=dd-item><a href=/navpatterns/1-patterns/released-entity/>Released Entity</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/report-selection/ title="Report Selection" class=dd-item><a href=/navpatterns/1-patterns/report-selection/>Report Selection</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/security/ title=Security class=dd-item><a href=/navpatterns/1-patterns/security/>Security</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/setup-specificity-fallback/ title="Setup Specificity Fallback" class=dd-item><a href=/navpatterns/1-patterns/setup-specificity-fallback/>Setup Specificity Fallback</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/silent-file-upload-and-download/ title="Silent File Upload and Download" class=dd-item><a href=/navpatterns/1-patterns/silent-file-upload-and-download/>Silent File Upload and Download</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/ title=Singleton class=dd-item><a href=/navpatterns/1-patterns/singleton/>Singleton</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-codeunit/ title="Singleton Codeunit" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-codeunit/>Singleton Codeunit</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/ title="Singleton Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/>Singleton Table</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/cue-table/ title="Cue Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/cue-table/>Cue Table</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/setup-table/ title="Setup Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/setup-table/>Setup Table</a></li></ul></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/standard-journal/ title="Standard Journal" class=dd-item><a href=/navpatterns/1-patterns/standard-journal/>Standard Journal</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/temporary-dataset-report/ title="Temporary Dataset Report" class=dd-item><a href=/navpatterns/1-patterns/temporary-dataset-report/>Temporary Dataset Report</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/totals-and-discounts-on-subpages-sales-and-purchases/ title="Totals and Discounts on Subpages Sales and Purchases" class=dd-item><a href=/navpatterns/1-patterns/totals-and-discounts-on-subpages-sales-and-purchases/>Totals and Discounts on Subpages Sales and Purchases</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/transfer-custom-fields/ title="Transfer Custom Fields" class=dd-item><a href=/navpatterns/1-patterns/transfer-custom-fields/>Transfer Custom Fields</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/variant-facade/ title="Variant Facade" class=dd-item><a href=/navpatterns/1-patterns/variant-facade/>Variant Facade</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/ title="2. Anti-Patterns" class=dd-item><a href=/navpatterns/2-anti-patterns/>2. Anti-Patterns</a><ul>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/nav-upgrade/ title="Nav Upgrade" class=dd-item><a href=/navpatterns/2-anti-patterns/nav-upgrade/>Nav Upgrade</a></li>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/reusable-bugs/ title="Reusable Bugs" class=dd-item><a href=/navpatterns/2-anti-patterns/reusable-bugs/>Reusable Bugs</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ title="3. CAL Coding Guidelines" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/>3. CAL Coding Guidelines</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/ title=Design class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/>Design</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/ title="Internally-used DotNet Types" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/>Internally-used DotNet Types</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/ title=Internationalization class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/>Internationalization</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/ title="Using Calcdate" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/>Using Calcdate</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/ title=Localizability class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/>Localizability</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/ title="CaptionML on System Pages" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/>CaptionML on System Pages</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/ title="FIELDCAPTION and TABLECAPTION" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/>FIELDCAPTION and TABLECAPTION</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/global-text-constants/ title="Global Text Constants" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/global-text-constants/>Global Text Constants</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/use-text-constants/ title="Use Text Constants" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/use-text-constants/>Use Text Constants</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/ title="Using OptionCaptionML" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/>Using OptionCaptionML</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/ title=Readability class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/>Readability</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/ title="Begin as an 'After Word'" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/>Begin as an 'After Word'</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-end/ title="Begin-End - Compound Only" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-end/>Begin-End - Compound Only</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/ title="Binary Operator to Start Line" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/>Binary Operator to Start Line</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/ title="Blank Lines.md" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/>Blank Lines.md</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/case-actions/ title="CASE Action" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/case-actions/>CASE Action</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/ title="Colon usage in CASE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/>Colon usage in CASE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/ title="Comments inside Curly Brackets" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/>Comments inside Curly Brackets</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/comments-spacing/ title="Comment Spacing" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/comments-spacing/>Comment Spacing</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/end-else-pair/ title="END ELSE Pair" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/end-else-pair/>END ELSE Pair</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/indentation/ title=Indentation class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/indentation/>Indentation</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/ title="Keyword Pairs - Indentation" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/>Keyword Pairs - Indentation</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/line-start-keywords/ title="Line Start Keywords" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/line-start-keywords/>Line Start Keywords</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/lonely-repeat/ title="Lonely Repeat" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/lonely-repeat/>Lonely Repeat</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/named-invocations/ title="Named Invocations" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/named-invocations/>Named Invocations</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/nested-withs/ title="Nested WITHs" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/nested-withs/>Nested WITHs</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/one-statement-per-line/ title="One Statement Per Line" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/one-statement-per-line/>One Statement Per Line</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/separate-if-and-else/ title="Separate IF and ELSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/separate-if-and-else/>Separate IF and ELSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/ title="Spacing Binary Operators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/>Spacing Binary Operators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/ title="Spacing Brackets and ::" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/>Spacing Brackets and ::</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/ title="Spacing Unary Operators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/>Spacing Unary Operators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/ title="Suggested Abbreviations" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/>Suggested Abbreviations</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/ title="Temporary Variable Naming" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/>Temporary Variable Naming</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/textconst-suffixes/ title="TextConst Suffixes" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/textconst-suffixes/>TextConst Suffixes</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/ title="Unary Operator Line End" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/>Unary Operator Line End</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/ title="Unnecessary Compound Parenthesis" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/>Unnecessary Compound Parenthesis</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-else/ title="Unnecessary ELSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-else/>Unnecessary ELSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/ title="Unnecessary Function Parenthesis" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/>Unnecessary Function Parenthesis</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-separators/ title="Unnecessary Separators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-separators/>Unnecessary Separators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/ title="Unnecessary TRUE/FALSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/>Unnecessary TRUE/FALSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variable-already-scoped/ title="Variable Already Scoped" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variable-already-scoped/>Variable Already Scoped</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variable-naming/ title="Variable Naming" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variable-naming/>Variable Naming</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variables-declarations-order/ title="Variables Declarations Order" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variables-declarations-order/>Variables Declarations Order</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/ title=UX class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/>UX</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/actions-images/ title="Actions - Images" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/actions-images/>Actions - Images</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/confirm/ title=CONFIRM class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/confirm/>CONFIRM</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/fielderror/ title=FIELDERROR class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/fielderror/>FIELDERROR</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/message-and-error/ title="MESSAGE and ERROR" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/message-and-error/>MESSAGE and ERROR</a></li></ul></li></ul></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/ title="(OLD) Get Involved" class=dd-item><a href=/navpatterns/4-get-involved/>(OLD) Get Involved</a><ul>
|
|
<li data-nav-id=/navpatterns/4-get-involved/code-of-conduct/ title="Code of Conduct" class=dd-item><a href=/navpatterns/4-get-involved/code-of-conduct/>Code of Conduct</a></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/patterns-authors/ title="Patterns Authors" class=dd-item><a href=/navpatterns/4-get-involved/patterns-authors/>Patterns Authors</a></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/template-for-writing-nav-design-patterns/ title="Template for writing Nav Design Patterns" class=dd-item><a href=/navpatterns/4-get-involved/template-for-writing-nav-design-patterns/>Template for writing Nav Design Patterns</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/related-links/ title="Related Links" class=dd-item><a href=/navpatterns/related-links/>Related Links</a></li></ul></li>
|
|
</ul>
|
|
<div id=shortcuts>
|
|
<div class=nav-title>More</div>
|
|
<ul>
|
|
<li><a class=padding href=https://discord.gg/4wbfNv3><i class="fab fa-discord"></i> BC Discord</a></li>
|
|
<li><a class=padding href=https://github.com/microsoft/bcalhelp><i class="fab fa-github"></i> GitHub repo</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id=footer>
|
|
<p>Built with <a href=https://github.com/McShelby/hugo-theme-relearn><i class="fas fa-heart"></i></a> by <a href=https://gohugo.io/>Hugo</a></p>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div id=body>
|
|
<div id=overlay></div>
|
|
<div class="padding highlightable">
|
|
<div id=top-bar>
|
|
<div id=top-github-link>
|
|
<a class=github-link title="Edit this page" href=https://github.com/microsoft/bcalhelp/edit/main/content/NAVPatterns/1-patterns/data-migration-facade/index.md target=blank>
|
|
<i class="fas fa-code-branch"></i>
|
|
<span id=top-github-link-text>Edit this page</span>
|
|
</a>
|
|
</div>
|
|
<div id=breadcrumbs>
|
|
<span id=sidebar-toggle-span>
|
|
<a href=# id=sidebar-toggle data-sidebar-toggle>
|
|
<i class="fas fa-bars"></i>
|
|
</a>
|
|
</span>
|
|
<span id=toc-menu><i class="fas fa-list-alt"></i></span>
|
|
<ol class=links itemscope itemtype=http://schema.org/BreadcrumbList>
|
|
<meta itemprop=itemListOrder content="Descending">
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="4"><a itemprop=item href=/><span itemprop=name>Home</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="3"><a itemprop=item href=/navpatterns/><span itemprop=name>NAV Patterns Archive</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="2"><a itemprop=item href=/navpatterns/1-patterns/><span itemprop=name>1. Patterns</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="1"><a itemprop=item href=/navpatterns/1-patterns/data-migration-facade/ aria-disabled=true><span itemprop=name>Data Migration Facade</span></a></li>
|
|
</ol>
|
|
</div>
|
|
<div class=progress>
|
|
<div class=wrapper>
|
|
<nav id=TableOfContents>
|
|
<ul>
|
|
<li><a href=#context>Context:</a></li>
|
|
<li><a href=#problem>Problem:</a></li>
|
|
<li><a href=#solution>Solution:</a></li>
|
|
<li><a href=#usage>Usage:</a>
|
|
<ul>
|
|
<li><a href=#usage-without-staging-tables>Usage without staging tables:</a></li>
|
|
<li><a href=#usage-with-staging-tables>Usage with staging tables:</a></li>
|
|
<li><a href=#combining-both-approaches>Combining both approaches:</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href=#error-handling-with-staging-tables>Error handling with staging tables:</a></li>
|
|
<li><a href=#limitations>Limitations:</a></li>
|
|
<li><a href=#usages-in-nav>Usages in NAV:</a></li>
|
|
<li><a href=#references>References:</a></li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id=head-tags>
|
|
</div>
|
|
<main id=body-inner>
|
|
<h1>Data Migration Facade</h1>
|
|
<h1 id=data-migration-façade><strong>Data Migration Façade</strong></h1>
|
|
<p><em>By David Bastide and Soumya Dutta at Microsoft Development Center Copenhagen</em></p>
|
|
<p><a href=8308.logo.png><img src=8308.logo.png alt=" "></a></p>
|
|
<h2 id=context>Context:</h2>
|
|
<p>This pattern is describing how you can migrate data using the Data Migration Façade.</p>
|
|
<h2 id=problem>Problem:</h2>
|
|
<p>Writing migration code from an external source, such as a product from a competitor, can be time consuming, as you need to tackle the problems of what to migrate, in which order, exception handling… and can result in code that is fragile due to deep dependencies on the NAV data model (high coupling). Any change to the NAV data model can easily break this code. ****</p>
|
|
<h2 id=solution>Solution:</h2>
|
|
<p>The idea of the Data Migration Façade is to provide an API that creates and updates master data and related entities (including transactions) without referencing NAV tables.</p>
|
|
<p>Additionally, the framework around the Data Migration Façade provides tools for error handling, and a way to integrate the migration in the Data Migration Overview page (page 1799).</p>
|
|
<p>The façade framework has the following components:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Two management codeunits:</p>
|
|
<ul>
|
|
<li><strong>Data Migration Façade</strong> (codeunit 6100): Integrates the extension to the Data Migration Wizard. Starts a migration, or restarts a migration that failed for some records.</li>
|
|
<li><strong>Data Migration Status Facade</strong> (codeunit 6101): Initializes and updates the status of the migration. The status displays in the <strong>Data Migration Overview</strong> page (page 1799).</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>Several master data migration façade codeunits that create and update entities. Each codeunit also contains events that help ensure that data is created in the correct order:</p>
|
|
<ul>
|
|
<li><strong>GL Acc. Data Migration Façade</strong> (codeunit 6110)</li>
|
|
<li><strong>Vendor Data Migration Façade</strong> (codeunit 6111)</li>
|
|
<li><strong>Customer Data Migration Façade</strong> (codeunit 6112)</li>
|
|
<li><strong>Item Data Migration Façade</strong> (codeunit 6113)</li>
|
|
<li>If you want to migrate other entities, it is possible to define your own codeunit that will contain your custom code (see ‘Usage’ below).</li>
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<p>A page where you can view the status and progress of the migration. It shows one line for each master data entity (item, customer, vendor, general ledger account) that was chosen for migration. You can also stop a migration by choosing the <strong>Stop Migration</strong> action.</p>
|
|
</li>
|
|
<li>
|
|
<ul>
|
|
<li><strong>Data Migration Overview</strong> (page 1799)</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<h2 id=usage>Usage:</h2>
|
|
<p>There are the following use cases:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Migration with staging tables, where data from another product is exported to a file or set of files, and the exported data is then imported to buffer tables, before running the migration logic. In this case, the migration is implemented in your extension codeunits, and it is called through events, one record at a time.</p>
|
|
</li>
|
|
<li>
|
|
<p>Migration without staging tables, for example, when you migrate data by importing it from an external tool such as external APIs and webservices. In this case, the migration is also implemented in your extension codeunits but it will be called through the OnRun procedure. You will be responsible for looping on the records to migrate, and you must migrate all records in this unique OnRun call for a given entity.</p>
|
|
</li>
|
|
</ul>
|
|
<p>To initialize and start the data migration, you must call the following procedures:</p>
|
|
<ul>
|
|
<li>**“Data Migration Status Façade”.InitStatusLine(‘My Migration Type’,Database::Item,42000,0,Codeunit::“My extension Item migration codeunit”) **<br>
|
|
This deletes existing status lines for migrating Items for ‘My Migration Type’, and initializes a new status line with 0 records migrated out of 42000.</li>
|
|
</ul>
|
|
<p>**“Data Migration Façade”.StartMigration(‘My Migration Type’,false) **<br>
|
|
This starts the migration. False means this is not a retry. A re-try is when you migrate one or more records from the <strong>Show Errors</strong> page, which is described later in this document. Retry = true is only used by the <strong>Show Errors</strong> page and should not be used from extensions.</p>
|
|
<h3 id=usage-without-staging-tables>Usage without staging tables:</h3>
|
|
<p>The overall workflow is:</p>
|
|
<ol>
|
|
<li>Integrate your extension in the <strong>Data Migration Wizard</strong> by subscribing to the events exposed by the <strong>Data Migration Façade</strong>.</li>
|
|
<li>From there, initialize the status of the migration so it can be displayed in the Data Migration Overview. When initializing the status lines, you provide the codeunit ID that will be called for each entity: <strong>“Data Migration Status Façade”.InitStatusLine(‘My Migration Type’,Database::Item,42000,0,Codeunit::“My extension Item migration codeunit”)</strong>.</li>
|
|
<li>Launch the migration: <strong>“Data Migration Façade”.StartMigration(‘My Migration Type’,false).</strong></li>
|
|
<li>Your migration codeunits are called one at a time (<strong>OnRun</strong>) in the following order:</li>
|
|
<li>G/L accounts (first, because customer/vendor posting groups refer to G/L accounts)</li>
|
|
<li>Customers</li>
|
|
<li>Vendors</li>
|
|
<li>Items (because discounts may refer to customer groups)</li>
|
|
<li>Others</li>
|
|
<li>Loop on all of the records to migrate. You can update the increment of the amount of records migrated: <strong>“Data Migration Status Facade”.IncrementStatusLine(‘My Migration Type’,Database::Item,42).</strong></li>
|
|
</ol>
|
|
<p><a href=NoStagingTableNew2.png><img src=NoStagingTableNew2.png alt=" "></a></p>
|
|
<p>_Figure 1: sequence diagram of the data migration without staging tables _</p>
|
|
<p>The following example shows how to migrate items without staging tables:</p>
|
|
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-al data-lang=al> <span style=color:#66d9ef>trigger</span> OnRun<span style=color:#f92672>()</span>;
|
|
<span style=color:#66d9ef>var</span>
|
|
ItemDataMigrationFacade: <span style=color:#66d9ef>Codeunit</span> "Item Data Migration Facade";
|
|
ItemNumber: <span style=color:#66d9ef>Integer</span>;
|
|
ItemJson: <span style=color:#66d9ef>Text</span>;
|
|
<span style=color:#66d9ef>begin</span>
|
|
<span style=color:#75715e>// loop on items retrieved through a web service for example
|
|
</span><span style=color:#75715e></span> <span style=color:#66d9ef>for</span> ItemNumber <span style=color:#f92672>:=</span> <span style=color:#ae81ff>1</span> <span style=color:#66d9ef>to</span> ExternalWebService<span style=color:#f92672>.</span>GetItemCount <span style=color:#66d9ef>do</span> <span style=color:#66d9ef>begin</span>
|
|
ExternalWebService<span style=color:#f92672>.</span>GetItem<span style=color:#f92672>(</span>ItemNumber,ItemJson<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// create item using the facade
|
|
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> <span style=color:#f92672>not</span> ItemDataMigrationFacade<span style=color:#f92672>.</span>CreateItemIfNeeded<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>ItemNumber,ItemJson<span style=color:#f92672>.</span>ItemName1,
|
|
ItemJson<span style=color:#f92672>.</span>ItemName2,ConvertItemType<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>ItemType<span style=color:#f92672>)) </span><span style=color:#66d9ef>then</span>
|
|
<span style=color:#66d9ef>exit</span>; <span style=color:#75715e>// item already exists
|
|
</span><span style=color:#75715e></span> <span style=color:#75715e>// set some fields using the facade
|
|
</span><span style=color:#75715e></span> ItemDataMigrationFacade<span style=color:#f92672>.</span>SetVendorItemNo<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>VendItemNumber<span style=color:#f92672>)</span>;
|
|
ItemDataMigrationFacade<span style=color:#f92672>.</span>SetUnitVolume<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>Volume<span style=color:#f92672>)</span>;
|
|
ItemDataMigrationFacade<span style=color:#f92672>.</span>SetAlternativeItemNo<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>AltItemNumber<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>if</span> ItemJson<span style=color:#f92672>.</span>PrimaryVendor <\> <span style=color:#e6db74>''</span> <span style=color:#66d9ef>then</span>
|
|
ItemDataMigrationFacade<span style=color:#f92672>.</span>SetVendorNo<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>PrimaryVendor<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// migrate dependencies
|
|
</span><span style=color:#75715e></span> MigrateItemUnitOfMeasure<span style=color:#f92672>(</span>ItemDataMigrationFacade,ItemJson<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// modify the item (+run trigger) to save the changes made by setters
|
|
</span><span style=color:#75715e></span> ItemDataMigrationFacade<span style=color:#f92672>.</span>ModifyItem<span style=color:#f92672>(</span>true<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// update the status in the migration dashboard
|
|
</span><span style=color:#75715e></span> DataMigrationStatusFacade<span style=color:#f92672>.</span>IncrementMigratedRecordCount<span style=color:#f92672>(</span><span style=color:#e6db74>'My Migration Type'</span>,
|
|
<span style=color:#66d9ef>Database</span>::Item,<span style=color:#ae81ff>1</span><span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>end</span>;
|
|
<span style=color:#66d9ef>end</span>;
|
|
<span style=color:#66d9ef>procedure</span> MigrateItemUnitOfMeasure<span style=color:#f92672>(</span>ItemDataMigrationFacade : <span style=color:#66d9ef>Codeunit</span> "Item Data Migration Facade";
|
|
ItemJson : <span style=color:#66d9ef>Text</span><span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>var</span>
|
|
MyUnitCodeStagingTable: <span style=color:#66d9ef>Record</span> "My Unit Code Staging Table";
|
|
DataMigrationStatusFacade: <span style=color:#66d9ef>Codeunit</span> "Data Migration Status Facade";
|
|
DescriptionToSet: <span style=color:#66d9ef>Text</span>\[<span style=color:#ae81ff>10</span>\];
|
|
UnitCodeJson: <span style=color:#66d9ef>Text</span>;
|
|
<span style=color:#66d9ef>begin</span>
|
|
<span style=color:#66d9ef>if</span> ItemJson<span style=color:#f92672>.</span>UnitCode = <span style=color:#e6db74>''</span> <span style=color:#66d9ef>then</span>
|
|
<span style=color:#75715e>// log an error using the Data migration façade
|
|
</span><span style=color:#75715e></span> DataMigrationStatusFacade<span style=color:#f92672>.</span>RegisterErrorNoStagingTablesCase<span style=color:#f92672>(
|
|
</span><span style=color:#f92672> </span><span style=color:#e6db74>'My Migration Type'</span>,<span style=color:#66d9ef>Database</span>::Item,<span style=color:#e6db74>'Unit of measure is empty.'</span><span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>if</span> ExternalWebService<span style=color:#f92672>.</span>GetUnitCode<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>UnitCode,UnitCodeJson<span style=color:#f92672>) </span><span style=color:#66d9ef>then</span>
|
|
DescriptionToSet <span style=color:#f92672>:=</span> UnitCodeJson<span style=color:#f92672>.</span>Description;
|
|
ItemDataMigrationFacade<span style=color:#f92672>.</span>CreateUnitOfMeasureIfNeeded<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>UnitCode, DescriptionToSet<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// set the unit of measure on the item
|
|
</span><span style=color:#75715e></span> ItemDataMigrationFacade<span style=color:#f92672>.</span>SetBaseUnitOfMeasure<span style=color:#f92672>(</span>ItemJson<span style=color:#f92672>.</span>UnitCode<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>end</span>;
|
|
</code></pre></div><p>_Figure 2: Example of Item and Item Unit of Measure migration without staging tables _</p>
|
|
<h3 id=usage-with-staging-tables>Usage with staging tables:</h3>
|
|
<p>The overall workflow is:</p>
|
|
<ul>
|
|
<li>
|
|
<p>Integrate your extension in the Data Migration Wizard by subscribing to the events exposed by the <strong>Data Migration Façade</strong>.</p>
|
|
</li>
|
|
<li>
|
|
<p>From there, initialize the status of the migration so it can be displayed in the <strong>Data Migration Overview: “Data Migration Status Façade”.InitStatusLine(‘My Migration Type’,Database::Item,42000,Database::“My extension Staging table for items”,0)</strong>.</p>
|
|
</li>
|
|
<li>
|
|
<p>You can either fill the staging tables from the wizard events, or in a subscriber to the event dedicated to filling staging tables (<strong>‘OnFillStagingTables’</strong> in codeunit 6100): in this case, the import of data from the files to the staging tables will be done in the background.</p>
|
|
</li>
|
|
<li>
|
|
<p>Launch the migration: <strong>“Data Migration Façade”.StartMigration(‘My Migration Type’,false)</strong>.</p>
|
|
</li>
|
|
<li>
|
|
<p>Subscribe to the events to migrate entities and their dependencies.</p>
|
|
</li>
|
|
<li>
|
|
<p>From the event subscribers, call the façade procedures to create entities and set their field values:</p>
|
|
</li>
|
|
<li>
|
|
<ul>
|
|
<li><strong>“Item Data Migration Façade”.CreateItemIfNeeded(‘ITEM042’,‘My Item Description’;‘My Item Description 2’;ItemTypeToSet::Inventory)</strong></li>
|
|
</ul>
|
|
</li>
|
|
<li></li>
|
|
<li></li>
|
|
</ul>
|
|
<p><a href=StagingTableNew2.png><img src=StagingTableNew2.png alt=" "></a></p>
|
|
<p><em>Figure 3: Simplified sequence diagram of the data migration with staging tables</em></p>
|
|
<p>Below is a simplified example showing how to create an item:</p>
|
|
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-al data-lang=al> [EventSubscriber<span style=color:#f92672>(</span><span style=color:#66d9ef>ObjectType</span>::<span style=color:#66d9ef>Codeunit</span>, <span style=color:#66d9ef>Codeunit</span>::"Item Data Migration Facade", <span style=color:#e6db74>'OnMigrateItem'</span>, <span style=color:#e6db74>''</span>, true, true<span style=color:#f92672>)</span>]
|
|
<span style=color:#66d9ef>procedure</span> OnMigrateItem<span style=color:#f92672>(</span><span style=color:#66d9ef>VAR</span> Sender : <span style=color:#66d9ef>Codeunit</span> "Item Data Migration Facade";RecordIdToMigrate : <span style=color:#66d9ef>RecordId</span><span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>var</span>
|
|
MyItemStagingTable : <span style=color:#66d9ef>Record</span> "My Item Staging Table";
|
|
<span style=color:#66d9ef>begin</span>
|
|
<span style=color:#75715e>// handle the event if it targets this extension's staging table
|
|
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> RecordIdToMigrate<span style=color:#f92672>.</span>TableNo <\> <span style=color:#66d9ef>Database</span>::"My Item Staging Table" <span style=color:#66d9ef>then</span>
|
|
<span style=color:#66d9ef>exit</span>;
|
|
MyItemStagingTable<span style=color:#f92672>.</span>Get<span style=color:#f92672>(</span>RecordIdToMigrate<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// create item using the facade
|
|
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> <span style=color:#f92672>not</span> Sender<span style=color:#f92672>.</span>CreateItemIfNeeded<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>ItemNumber,MyItemStagingTable<span style=color:#f92672>.</span>ItemName1,
|
|
MyItemStagingTable<span style=color:#f92672>.</span>ItemName2,ConvertItemType<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>ItemType<span style=color:#f92672>)) </span><span style=color:#66d9ef>then</span>
|
|
<span style=color:#66d9ef>exit</span>; <span style=color:#75715e>// item already exists
|
|
</span><span style=color:#75715e></span> <span style=color:#75715e>// set some fields using the facade
|
|
</span><span style=color:#75715e></span> Sender<span style=color:#f92672>.</span>SetVendorItemNo<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>VendItemNumber<span style=color:#f92672>)</span>;
|
|
Sender<span style=color:#f92672>.</span>SetUnitVolume<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>Volume<span style=color:#f92672>)</span>;
|
|
Sender<span style=color:#f92672>.</span>SetAlternativeItemNo<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>AltItemNumber<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>if</span> MyItemStagingTable<span style=color:#f92672>.</span>PrimaryVendor <\> <span style=color:#e6db74>''</span> <span style=color:#66d9ef>then</span>
|
|
Sender<span style=color:#f92672>.</span>SetVendorNo<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>PrimaryVendor<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// modify the item (+run trigger) to save the changes made by setters
|
|
</span><span style=color:#75715e></span> Sender<span style=color:#f92672>.</span>ModifyItem<span style=color:#f92672>(</span>true<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>end</span>;
|
|
</code></pre></div><p><em>Figure 4: Example of event subscriber for Item migration</em></p>
|
|
<p>Below is another example showing how to use additional events to set fields that reference other tables, here the unit of measure:</p>
|
|
<div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-al data-lang=al> [EventSubscriber<span style=color:#f92672>(</span><span style=color:#66d9ef>ObjectType</span>::<span style=color:#66d9ef>Codeunit</span>, <span style=color:#66d9ef>Codeunit</span>::"Item Data Migration Facade", <span style=color:#e6db74>'OnMigrateItemUnitOfMeasure'</span>, <span style=color:#e6db74>''</span>, true, true<span style=color:#f92672>)</span>]
|
|
<span style=color:#66d9ef>procedure</span> OnMigrateItemUnitOfMeasure<span style=color:#f92672>(</span><span style=color:#66d9ef>VAR</span> Sender : <span style=color:#66d9ef>Codeunit</span> "Item Data Migration Facade";RecordIdToMigrate : <span style=color:#66d9ef>RecordId</span><span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>var</span>
|
|
MyItemStagingTable : <span style=color:#66d9ef>Record</span> "My Item Staging Table";
|
|
MyUnitCodeStagingTable : <span style=color:#66d9ef>Record</span> "My Unit Code Staging Table";
|
|
DescriptionToSet: <span style=color:#66d9ef>Text</span>[<span style=color:#ae81ff>10</span>];
|
|
<span style=color:#66d9ef>begin</span>
|
|
<span style=color:#75715e>// handle the event if it targets this extension's staging table
|
|
</span><span style=color:#75715e></span> <span style=color:#66d9ef>if</span> RecordIdToMigrate<span style=color:#f92672>.</span>TableNo <\> <span style=color:#66d9ef>Database</span>::"My Item Staging Table" <span style=color:#66d9ef>then</span>
|
|
<span style=color:#66d9ef>exit</span>;
|
|
MyItemStagingTable<span style=color:#f92672>.</span>Get<span style=color:#f92672>(</span>RecordIdToMigrate<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>if</span> MyItemStagingTable<span style=color:#f92672>.</span>UnitCode = <span style=color:#e6db74>''</span> <span style=color:#66d9ef>then</span>
|
|
error<span style=color:#f92672>(</span><span style=color:#e6db74>'Unit of measure is empty.'</span><span style=color:#f92672>)</span>;
|
|
MyUnitCodeStagingTable<span style=color:#f92672>.</span>SetRange<span style=color:#f92672>(</span>UnitCode,MyItemStagingTable<span style=color:#f92672>.</span>UnitCode<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>if</span> MyUnitCodeStagingTable<span style=color:#f92672>.</span>FindFirst <span style=color:#66d9ef>then</span>
|
|
DescriptionToSet <span style=color:#f92672>:=</span> MyUnitCodeStagingTable<span style=color:#f92672>.</span>Description;
|
|
<span style=color:#75715e>// create the unit of measure through the facade
|
|
</span><span style=color:#75715e></span> Sender<span style=color:#f92672>.</span>CreateUnitOfMeasureIfNeeded<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>UnitCode, DescriptionToSet<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// set the unit of measure on the item
|
|
</span><span style=color:#75715e></span> Sender<span style=color:#f92672>.</span>SetBaseUnitOfMeasure<span style=color:#f92672>(</span>MyItemStagingTable<span style=color:#f92672>.</span>UnitCode<span style=color:#f92672>)</span>;
|
|
<span style=color:#75715e>// modify the item to save the changes made by setter
|
|
</span><span style=color:#75715e></span> Sender<span style=color:#f92672>.</span>ModifyItem<span style=color:#f92672>(</span>false<span style=color:#f92672>)</span>;
|
|
<span style=color:#66d9ef>end</span>;
|
|
</code></pre></div><p><em>Figure 5: Example of event subscriber for Item Unit of Measure migration</em></p>
|
|
<h3 id=combining-both-approaches>Combining both approaches:</h3>
|
|
<p>If you want to migrate additional entities, the **Data Migration **framework lets you initialize the migration with entities other than master data. In this case, the <strong>Data Migration Overview</strong> page will show additional lines. Item, vendor, customer, an general ledger accounts are migrated with an event driven approach, and the additional entities are migrated by calling an extension codeunit <strong>OnRun</strong> method.</p>
|
|
<h2 id=error-handling-with-staging-tables>Error handling with staging tables:</h2>
|
|
<p>The migration starts by calling <strong>RUN</strong> on the façade codeunit. Errors thrown during the call are captured by <strong>GETLASTERRORTEXT</strong> and displayed when you choose the <strong>Show Errors</strong> action on the <strong>Data Migration Overview</strong> page.</p>
|
|
<p><a href=errorhandling1.png><img src=errorhandling1.png alt=" "></a></p>
|
|
<p><em>Figure 6: List of errors shown when clicking <strong>Show Errors</strong> on the <strong>Data Migration Overview</strong> page</em></p>
|
|
<p>__</p>
|
|
<p>The <strong>Edit Record</strong> action opens a view of the staging table, where you can edit fields to fix errors. Figure 4 shows an example of a page for the vendor staging table in a migration from C5.</p>
|
|
<p><a href=errorhandling2.png><img src=errorhandling2.png alt=" "></a></p>
|
|
<p><em>Figure 7: Edit a staging table record</em></p>
|
|
<p>__</p>
|
|
<p>The <strong>Staging Table ID</strong> determines the page to open, so it is important that the page ID is equal to the <strong>Staging Table ID</strong>, at least for the master data staging tables, for example, for<strong>G/L Accounts, Items, Customers</strong> and <strong>Vendor</strong>. You should ensure that pages to edit related entities are linked on this page by means of new actions. For example, Figure 4 uses the <strong>C5 Purchaser</strong> action.</p>
|
|
<p>After you fix the staging table record, you can choose the <strong>Migrate</strong> action to mark the selected records as records to retry, and then run <strong>StartMigration</strong> with the <strong>Retry</strong> flag set to true. This is the only place where the retry flag should be set to true in the <strong>StartMigration</strong> procedure.</p>
|
|
<p>Error handling without staging tables</p>
|
|
<p>When migrating data without staging tables, errors can be registered manually by the extension using <strong>DataMigrationStatusFacade.RegisterErrorNoStagingTablesCase</strong>. Otherwise they can be registered automatically if the codeunits fail when called on their <strong>OnRun</strong> procedure.</p>
|
|
<p>Errors will be displayed in the error list, but you cannot open and edit records because there is no staging table. The Edit action will not be available.</p>
|
|
<h2 id=limitations>Limitations:</h2>
|
|
<ul>
|
|
<li>
|
|
<p>Data migration will fail if there are customers, vendors, items in the database and if these entities are selected for migration. For example, if you choose to migrate items and your company already contains items, you will get an error. This should not be an issue if you migrate your data from another tool to NAV, in which case you will most likely start on a fresh empty company. However, if you just want to import additional items to a company with existing items, then it is not supported by the framework. however, you can still use the different functions provided by the different codeunits (such as <strong>Item Data Migration Facade</strong>) to create the entities without strong coupling on the NAV data model.</p>
|
|
</li>
|
|
<li>
|
|
<p><strong>G/L entries</strong> are deleted automatically.</p>
|
|
</li>
|
|
<li>
|
|
<p>There is no automated rollback in case of failure: data that is successfully migrated will be commited, and data that is not successfully migrated with be shown in the errors list. The retry feature (in case of staging tables) then makes it possible for you to retry individual entities or ignore them.</p>
|
|
</li>
|
|
</ul>
|
|
<h2 id=usages-in-nav>Usages in NAV:</h2>
|
|
<p>The Data Migration Façade is available starting from version 2018.</p>
|
|
<p>The following Façade codeunits for data migration management are available:</p>
|
|
<ul>
|
|
<li>
|
|
<p>COD6100 (<strong>Data Migration Facade</strong>)</p>
|
|
</li>
|
|
<li>
|
|
<p>COD6101 (<strong>Data Migration Status Facade</strong>)</p>
|
|
</li>
|
|
</ul>
|
|
<p>The following Entity data migration façade codeunits are available:</p>
|
|
<ul>
|
|
<li>
|
|
<p>COD6110 (<strong>GL Acc. Data Migration Facade</strong>)</p>
|
|
</li>
|
|
<li>
|
|
<p>COD6111 (<strong>Vendor Data Migration Facade</strong>)</p>
|
|
</li>
|
|
<li>
|
|
<p>COD6112 (<strong>Customer Data Migration Facade</strong>)</p>
|
|
</li>
|
|
<li>
|
|
<p>COD6113 (<strong>Item Data Migration Facade</strong>)</p>
|
|
</li>
|
|
<li>
|
|
<p>COD6114 (<strong>Ex. Rate Data Migration Facade</strong>)</p>
|
|
</li>
|
|
</ul>
|
|
<h2 id=references>References:</h2>
|
|
<p>Façade pattern on Wikipedia: <a href=https://en.wikipedia.org/wiki/Facade>https://en.wikipedia.org/wiki/Facade</a>_pattern</p>
|
|
<footer class=footline>
|
|
</footer>
|
|
</main>
|
|
</div>
|
|
<div id=navigation>
|
|
<a class="nav nav-prev" href=/navpatterns/1-patterns/currently-active-record/ title="Currently Active Record"><i class="fa fa-chevron-left"></i></a>
|
|
<a class="nav nav-next" href=/navpatterns/1-patterns/discovery-event/ title="Discovery Event"><i class="fa fa-chevron-right"></i></a>
|
|
</div>
|
|
</div>
|
|
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
|
|
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
|
|
</div>
|
|
<script src=/js/clipboard.min.js?1636530359></script>
|
|
<script src=/js/perfect-scrollbar.min.js?1636530359></script>
|
|
<script src=/js/perfect-scrollbar.jquery.min.js?1636530359></script>
|
|
<script src=/js/jquery.svg.pan.zoom.js?1636530359></script>
|
|
<script src=/js/featherlight.min.js?1636530359></script>
|
|
<script src=/js/modernizr.custom-3.6.0.js?1636530359></script>
|
|
<script src=/js/relearn.js?1636530359></script>
|
|
</body>
|
|
</html> |