alguidelines/navpatterns/1-patterns/notifications/in-context-notifications/index.html
2021-12-05 21:23:42 +00:00

405 lines
No EOL
50 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.4">
<meta name=description content>
<title>In-context Notifications :: AL Guidelines</title>
<link href=/css/nucleus.css?1638739418 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1638739418 rel=stylesheet>
<link href=/css/featherlight.min.css?1638739418 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1638739418 rel=stylesheet>
<link href=/css/auto-complete.css?1638739418 rel=stylesheet>
<link href=/css/theme.css?1638739418 rel=stylesheet>
<link href=/css/theme-blue.css?1638739418 rel=stylesheet>
<link href=/css/variant.css?1638739418 rel=stylesheet>
<link href=/css/print.css?1638739418 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1638739418></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/1-patterns/notifications/in-context-notifications/>
<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:segoe ui semibold,segoe ui,SegoeUI,helvetica neue,Helvetica,Arial,sans-serif;font-size:30px;font-weight:300;margin-top:-2px">
ALGuidelines.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?1638739418></script>
<script src=/js/auto-complete.js?1638739418></script>
<script src=/js/search.js?1638739418></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>
<li data-nav-id=/bcpatterns/facade-pattern/ title="Facade Pattern" class=dd-item><a href=/bcpatterns/facade-pattern/>Facade Pattern</a></li>
<li data-nav-id=/bcpatterns/generic-method-pattern/ title="Generic Method Pattern" class=dd-item><a href=/bcpatterns/generic-method-pattern/>Generic Method Pattern</a></li></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 Façade" class=dd-item><a href=/navpatterns/1-patterns/data-migration-facade/>Data Migration Façade</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 parent"><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 active"><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><ul>
<li data-nav-id=/navpatterns/1-patterns/security/1-sensitive-data-encapsulation/ title="Sensitive Data Encapsulation" class=dd-item><a href=/navpatterns/1-patterns/security/1-sensitive-data-encapsulation/>Sensitive Data Encapsulation</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/2-data-encryption/ title="Data Encryption" class=dd-item><a href=/navpatterns/1-patterns/security/2-data-encryption/>Data Encryption</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/3-single-point-of-access/ title="Single Point of Access" class=dd-item><a href=/navpatterns/1-patterns/security/3-single-point-of-access/>Single Point of Access</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/4-masked-text/ title="Masked Text" class=dd-item><a href=/navpatterns/1-patterns/security/4-masked-text/>Masked Text</a></li>
<li data-nav-id=/navpatterns/1-patterns/security/5-ssl-in-nav/ title="SSL in NAV" class=dd-item><a href=/navpatterns/1-patterns/security/5-ssl-in-nav/>SSL in NAV</a></li></ul></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><ul>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/ title="By Reference Parameters" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/>By Reference Parameters</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/class-coupling/ title="Class Coupling" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/class-coupling/>Class Coupling</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/ title="Cyclomatic Complexity" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/>Cyclomatic Complexity</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/ title="Encapsulate Local Functionality" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/>Encapsulate Local Functionality</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/ title="FINDSET FINDFIRST FINDLAST" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/>FINDSET FINDFIRST FINDLAST</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/initialized-variables/ title="Initialized Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/initialized-variables/>Initialized Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/maintainability-index/ title="Maintainability Index" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/maintainability-index/>Maintainability Index</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/ title="Parameter Placeholders" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/>Parameter Placeholders</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/static-object-invocation/ title="Static Object Invocation" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/static-object-invocation/>Static Object Invocation</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unreachable-code/ title="Unreachable Code" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unreachable-code/>Unreachable Code</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/ title="Unused Initialized Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/>Unused Initialized Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/unused-variables/ title="Unused Variables" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/unused-variables/>Unused Variables</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/ title="Variable Capacity Mismatch" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/>Variable Capacity Mismatch</a></li>
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/ title="WITH Scope Name Collision" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/>WITH Scope Name Collision</a></li></ul></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" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/>Blank Lines</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>
<li data-nav-id=/contributing/ title=Contributing class=dd-item><a href=/contributing/><b><i class="fas fa-clone"></i> </b>Contributing</a><ul>
<li data-nav-id=/contributing/formattingtips/ title="Formatting tips" class=dd-item><a href=/contributing/formattingtips/><b><i class="fas fa-clone"></i> </b>Formatting tips</a></li>
<li data-nav-id=/contributing/forkandpr/ title="Guide to Fork & PR" class=dd-item><a href=/contributing/forkandpr/><b><i class="fas fa-clone"></i> </b>Guide to Fork & PR</a></li>
<li data-nav-id=/contributing/templates/ title=Templates class=dd-item><a href=/contributing/templates/><b><i class="fas fa-clone"></i> </b>Templates</a><ul>
<li data-nav-id=/contributing/templates/guidelines/ title="Title of the Guideline" class=dd-item><a href=/contributing/templates/guidelines/>Title of the Guideline</a></li>
<li data-nav-id=/contributing/templates/patterns/ title="Title of the pattern" class=dd-item><a href=/contributing/templates/patterns/>Title of the pattern</a></li></ul></li>
<li data-nav-id=/contributing/theapprovalprocess/ title="Understanding the Approval Process" class=dd-item><a href=/contributing/theapprovalprocess/><b><i class="fas fa-clone"></i> </b>Understanding the Approval Process</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/alguidelines><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/alguidelines/edit/main/content/NAVPatterns/1-patterns/notifications/in-context-notifications/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="5"><a itemprop=item href=/><span itemprop=name>Home</span></a> > </li>
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="4"><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="3"><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="2"><a itemprop=item href=/navpatterns/1-patterns/notifications/><span itemprop=name>Notifications</span></a> > </li>
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="1"><a itemprop=item href=/navpatterns/1-patterns/notifications/in-context-notifications/ aria-disabled=true><span itemprop=name>In-context Notifications</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=#raising-a-notification>Raising a notification</a>
<ul>
<li><a href=#identifying-a-notification>Identifying a notification</a></li>
<li><a href=#including-messages-notifications>Including messages notifications</a></li>
<li><a href=#invoking-actions-on-notifications>Invoking actions on notifications</a></li>
<li><a href=#populating-parameters-on-notifications>Populating parameters on notifications</a></li>
<li><a href=#displaying-the-notification-to-the-user>Displaying the notification to the user</a></li>
</ul>
</li>
<li><a href=#turning-notifications-on-or-off-and-controlling-when-they-are-sent>Turning notifications on or off, and controlling when they are sent</a></li>
</ul>
</nav>
</div>
</div>
</div>
<div id=head-tags>
</div>
<main id=body-inner>
<h1>In-context Notifications</h1>
<p><em>By Soumya Dutta at Microsoft Development Center Copenhagen</em></p>
<h2 id=context>Context</h2>
<p>Application developers need to raise a notification on events that are not blocking but do require attention from users. Notifications alert users to issues or information, and let them decide whether to react immediately or finish what they&rsquo;re doing first.</p>
<h2 id=problem>Problem</h2>
<p>Application developers have started to use system calls like CONFIRM or MESSAGE to alert or inform users about a condition. These calls interrupt users by displaying a window in the middle of the screen and forcing an immediate response.</p>
<h2 id=solution>Solution</h2>
<p>Notifications display a message in a blue bar at the top of the workspace, as shown in Figure 1.</p>
<p><a href=7701.Fig1.png><img src=7701.Fig1.png alt=" "></a></p>
<p>Figure 1 - Example of a notification</p>
<p>Notifications alert users to something they probably should act on, but can choose to ignore. For example, a notification might alert someone who is about to invoice a customer for inventory that isn&rsquo;t available, as shown in Figure 1, but allow them to post the invoice anyway. This is different from an error that prevents someone from posting an invoice without specifying a required field.</p>
<p>In this example, if you choose <strong>Details</strong> a page opens to show the status of the inventory, as shown in Figure 2.</p>
<p><a href=6724.Fig2.png><img src=6724.Fig2.png alt=" "></a></p>
<p>Figure 2 - Clicking an action in a notification</p>
<h2 id=raising-a-notification>Raising a notification</h2>
<p>The code in Figure 3 raises the notification in Figure 1.</p>
<p><strong>COD 311: Item-Check Avail.</strong></p>
<p><strong>CreateAndSendNotification</strong></p>
<p>AvailabilityCheckNotification.ID(GetItemAvailabilityNotificationId);</p>
<p>AvailabilityCheckNotification.MESSAGE(STRSUBSTNO(NotificationMsg,ItemNo));</p>
<p>AvailabilityCheckNotification.SCOPE(NOTIFICATIONSCOPE::LocalScope);</p>
<p>AvailabilityCheckNotification.ADDACTION(DetailsTxt,CODEUNIT::&ldquo;Item-Check Avail.&rdquo;,&lsquo;ShowNotificationDetails&rsquo;);</p>
<p>ItemAvailabilityCheck.PopulateDataOnNotification(AvailabilityCheckNotification,ItemNo,UnitOfMeasureCode</p>
<p>,InventoryQty,GrossReq,ReservedReq,SchedRcpt,ReservedRcpt,CurrentQuantity,CurrentReservedQty,</p>
<p>TotalQuantity,EarliestAvailDate);</p>
<p>AvailabilityCheckNotification.SEND;</p>
<p>&mldr;</p>
<p>Figure 3 - Raising a notification</p>
<p>The first thing to note is that a new Notification DataType object has been introduced to C/SIDE.</p>
<p><a href=2514.Fig4.png><img src=2514.Fig4.png alt=" "></a></p>
<p>Figure 4. Notification is a new data type</p>
<p>In the code sample in Figure 3, the first line defines the scope. Currently , only the LocalScope is supported.</p>
<h3 id=identifying-a-notification>Identifying a notification</h3>
<p>The ID is an optional parameter for the notification object that tracks the object in communications between the client and the server. Notifications have unique IDs that can be hard coded as GUIDs, as shown in Figure 5. A GUID can be generated using <a href=https://msdn.microsoft.com/en-us/library/dd339033.aspx>the CREATEGUID system function</a>.</p>
<p><strong>COD 311: Item-Check Avail.</strong></p>
<p><strong>GetItemAvailabilityNotificationId</strong></p>
<p>EXIT(&lsquo;2712AD06-C48B-4C20-820E-347A60C9AD00&rsquo;);****</p>
<p>Figure 5. Uniquely identifying a notification</p>
<p>If the call to set ID is skipped, sending the notification creates a new notification with an ID that is generated at run-time instead of updating a notification that is already displayed (if present) with the ID.</p>
<h3 id=including-messages-notifications>Including messages notifications</h3>
<p>Notifications should display a message. This message is set by an assignment call to the <strong>MESSAGE</strong> parameter of the notification object.</p>
<h3 id=invoking-actions-on-notifications>Invoking actions on notifications</h3>
<p>Notifications can display action buttons, as shown in Figure 2 where a button named <strong>Details</strong> opens the inventory status for the item. To do that, when the button is clicked the <strong>ADDACTION</strong> method is invoked on the notification object using the following parameters:</p>
<ul>
<li>The text for the button.</li>
<li>The code unit number that hosts the method to call.</li>
<li>The name of the invoked method in the above code unit to call.</li>
</ul>
<p>Figure shows the method that is called when the action is invoked- ShowNotificationDetails.</p>
<p><strong>COD 311: Item-Check Avail.</strong></p>
<p><strong>ShowNotificationDetails</strong></p>
<p>ItemAvailabilityCheck.InitializeFromNotification(AvailabilityCheckNotification);</p>
<p>ItemAvailabilityCheck.SetHeading(AvailabilityCheckNotification.MESSAGE);</p>
<p>ItemAvailabilityCheck.RUNMODAL;****</p>
<p>Figure 6 - Invoking an action</p>
<p>To show the inventory status using the Availability check page, certain parameters must be initialized. For example, the item number, the unit of measure code, and so on. This is done in the call to InitializeFromNotification method on the page. Figure 7 shows the code for this call.</p>
<p><strong>Page 1872: Item Availability Check</strong></p>
<p><strong>InitializeFromNotification</strong></p>
<p>GET(AvailabilityCheckNotification.GETDATA(&lsquo;ItemNo&rsquo;));</p>
<p>SETRANGE(&ldquo;No.",AvailabilityCheckNotification.GETDATA(&lsquo;ItemNo&rsquo;));</p>
<p>EVALUATE(TotalQuantity,AvailabilityCheckNotification.GETDATA(&lsquo;TotalQuantity&rsquo;));</p>
<p>EVALUATE(InventoryQty,AvailabilityCheckNotification.GETDATA(&lsquo;InventoryQty&rsquo;));</p>
<p>CurrPage.AvailabilityCheckDetails.PAGE.SetUnitOfMeasureCode(</p>
<p>AvailabilityCheckNotification.GETDATA(&lsquo;UnitOfMeasureCode&rsquo;));</p>
<p>Figure 7 - Fetching parameters from a notification object</p>
<p>Note how <strong>GETDATA</strong> uses a key to fetch values from the notification object, and how those values are used to initialize the page.</p>
<p>Notifications can include zero, one, or more than one action buttons. More than one action buttons result in multiple <strong>ADDACTION</strong> calls to the notification object.</p>
<h3 id=populating-parameters-on-notifications>Populating parameters on notifications</h3>
<p>Actions use the values set on the notification objects. As shown in Figure 3 and Figure 7, the line that calls the method PopulateDataOnNotification does that. The result is shown in Figure 8.</p>
<p><strong>Page 1872: Item Availability Check</strong></p>
<p><strong>PopulateDataOnNotification</strong></p>
<p>AvailabilityCheckNotification.SETDATA(&lsquo;ItemNo&rsquo;,ItemNo);</p>
<p>AvailabilityCheckNotification.SETDATA(&lsquo;UnitOfMeasureCode&rsquo;,UnitOfMeasureCode);</p>
<p>AvailabilityCheckNotification.SETDATA(&lsquo;GrossReq&rsquo;,FORMAT(GrossReq));</p>
<p>&mldr;</p>
<p>Figure 8 - Populating parameters on notifications</p>
<p>The invoked method must be stateless. Therefore, the context for creating the notification should be reproducible by using data that could be a part of the notification object. In this example, the SETDATA method on the notification object passes values for the item number, unit of measure code, and so on, as key value pairs.</p>
<h3 id=displaying-the-notification-to-the-user>Displaying the notification to the user</h3>
<p>The last line in Figure 3 calls <strong>SEND</strong> to display the notification. If you know the ID of the notification, you can also call <strong>RECALL</strong> to hide it. However, avoid updating a displayed notification, for example by changing the message, by calling both <strong>RECALL</strong> and <strong>SEND</strong>. This makes two server&ndash;client calls. Instead, call only <strong>SEND</strong>. Calling <strong>SEND</strong> for a notification that is already displayed updates the notification.</p>
<h2 id=turning-notifications-on-or-off-and-controlling-when-they-are-sent>Turning notifications on or off, and controlling when they are sent</h2>
<p>By default, all notifications are turned on. However, you can specify the notifications you want to receive, and turn on or turn off some or all of them. For example, if you don&rsquo;t want to be disturbed or are willing to accept the consequences of ignoring the message. This is unique to notifications.</p>
<p><a href=6646.Fig9.png><img src=6646.Fig9.png alt=" "></a></p>
<p>Figure 9 - The My Notifications page</p>
<p>Additionally, some notifications let you specify the conditions under which they are sent. For example, if you want to be notified when inventory is running low, but only for items you buy from a certain vendor.</p>
<ol>
<li>In the top right corner, choose the Search for Page or Report icon, enter my notifications, and then choose the related link.</li>
<li>To turn on or turn off a notification, select or clear the Enabled check box.</li>
<li>To specify conditions that trigger a notification, choose View filter details, and then fill in the fields.</li>
</ol>
<p>The <strong>MyNotifications</strong> object determines whether notifications are turned on or off. Notifications are isolated from each other by the hard-coded GUID, as discussed in the section titled Identifying a notification. A fixed ID is essential to turning off a notification. The following are ways to achieve this.</p>
<ol>
<li><strong>OnInitializingNotificationWithDefaultState</strong> is a published method on the <strong>MyNotifications</strong> page that is called when the enabled state of all the notifications is initialized.</li>
</ol>
<p><strong>Codeunit 311: Item-Check Avail.</strong></p>
<p><strong>OnInitializingNotificationWithDefaultState</strong></p>
<p>MyNotifications.InsertDefaultWithTableNum(GetItemAvailabilityNotificationId,</p>
<p>ItemAvailabilityNotificationTxt,</p>
<p>ItemAvailabilityNotificationDescriptionTxt,</p>
<p>DATABASE::Item);</p>
<p>Figure 10 - Adding a notification to the My Notifications page</p>
<p>You must subscribe to this method and call either <strong>InsertDefault</strong> or <strong>InsertDefaultWithTableNum</strong> on the <strong>MyNotifications</strong> table. Both of these take the ID of the notification, a short description of the notification, and text that provides details about the conditions for the notification. The difference is that the <strong>InsertDefaultWithTableNum</strong> method takes an additional argument representing the table number if there is specific criteria for when to turn on a notification for a certain table. In this case, the notification can be enabled only for items that the criteria specified in the FilterPage. The FIlterPage is opened from the <strong>MyNotifications</strong> page.</p>
<p><a href=2526.Fig11.png><img src=2526.Fig11.png alt=" "></a></p>
<p>Figure 11 - Defining filter criteria to turn on a notification</p>
<ol>
<li><strong>IsEnabled</strong> or <strong>IsEnabledForRecord</strong> are used to query if the notification is turned on. It may make sense to call this as early as possible in the condition checks, so you don&rsquo;t make calculations that will not yield much if the notification is turned off. The second method takes the additional parameter that represents the record for which the enabled state is to be determined. In Figure 12, the check is for an item.</li>
</ol>
<p><strong>Codeunit 311: Item-Check Avail.</strong></p>
<p><strong>IsItemAvailabilityNotificationEnabled</strong></p>
<p><strong>EXIT</strong>(MyNotifications.IsEnabledForRecord(GetItemAvailabilityNotificationId,Item));</p>
<p>Figure 12 - Checking whether notifications are turned on</p>
<p>You may check that the call to this function is made almost as the first step in checking for availability.</p>
<ol>
<li><strong>OnStateChanged</strong> event should be subscribed to if the developer needs to do something additional when changing the state of a notification, such as turn on another notification.</li>
</ol>
<p>The ability to turn notifications on or off is not required. If skipped, the notification is always shown when the condition that triggers it is met, and a user cannot turn it off.</p>
<h1 id=nav-specific-usages>NAV specific usages</h1>
<p>For examples of how these objects are used in Dynamics NAV, look at the code for the following objects:</p>
<ol>
<li>Codeunit 1802 Data Migration Notifier</li>
<li>Codeunit 311 Item-Check Avail.</li>
<li>Codeunit 312 Cust-Check Cr. Limit</li>
<li>Codeunit 1854 Item Sales Forecast Notifier (in SalesAndInventoryForecast extension)</li>
<li>Codeunit 1852 Item Sales Forecast Scheduler (in SalesAndInventoryForecast extension)</li>
</ol>
<h1 id=best-practices>Best practices</h1>
<p>The following list summarizes best practices for creating notifications:</p>
<ol>
<li>Do not set data on the notification that you will not use in the method invoked from the action button.</li>
<li>Ensure that the <strong>MyNotifications</strong> table is accessed only as described above, and that the correct pairs of calls are made. For example, <strong>InsertDefault</strong>&mldr;<strong>IsEnabled</strong> and <strong>InsertDefaultWithTableNum</strong> &mldr;<strong>IsEnabledForRecord</strong>.</li>
<li>Do not call <strong>RECALL</strong> before <strong>SEND</strong> in a server call-back if you need to update a notification that is already displayed. Instead, call only <strong>SEND</strong> to update the notification. This reduces traffic on the network.</li>
<li>Ensure that the method specified on the <strong>ADDACTION</strong> method for the notification is (a) exists, (b) is global and (c) follows the signature described above.</li>
</ol>
<footer class=footline>
</footer>
</main>
</div>
<div id=navigation>
<a class="nav nav-prev" href=/navpatterns/1-patterns/notifications/ title=Notifications><i class="fa fa-chevron-left"></i></a>
<a class="nav nav-next" href=/navpatterns/1-patterns/notifications/notification-lifecycle-management-pattern/ title="Notification Lifecycle Management Pattern"><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?1638739418></script>
<script src=/js/perfect-scrollbar.min.js?1638739418></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1638739418></script>
<script src=/js/jquery.svg.pan.zoom.js?1638739418></script>
<script src=/js/featherlight.min.js?1638739418></script>
<script src=/js/modernizr.custom-3.6.0.js?1638739418></script>
<script src=/js/relearn.js?1638739418></script>
</body>
</html>