<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohamed Islem kehoul on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Islem kehoul on Medium]]></description>
        <link>https://medium.com/@islemkehoul98?source=rss-1efeb46ca3d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OKRPT1W90Zbn5FCU</url>
            <title>Stories by Mohamed Islem kehoul on Medium</title>
            <link>https://medium.com/@islemkehoul98?source=rss-1efeb46ca3d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:03:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@islemkehoul98/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ Preventing Data Tampering in Historical Tables in Business Central]]></title>
            <link>https://medium.com/@islemkehoul98/preventing-data-tampering-in-historical-tables-in-business-central-667f7074968f?source=rss-1efeb46ca3d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/667f7074968f</guid>
            <dc:creator><![CDATA[Mohamed Islem kehoul]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 13:51:01 GMT</pubDate>
            <atom:updated>2025-06-11T13:51:01.035Z</atom:updated>
            <content:encoded><![CDATA[<h3>🧩 The Problem</h3><p>When developing extensions in Microsoft Dynamics 365 Business Central, it’s common to create <strong>custom tables and pages to archive or store historical data</strong>. Examples include:</p><ul><li><strong>Payment Request Headers</strong>: Where validated payments are stored.</li><li><strong>Archived Sales Orders</strong>, <strong>Posted Invoices</strong>, or <strong>Historical Price Lists</strong>.</li></ul><p>These tables play a <strong>critical role in auditability and traceability</strong>, especially in financial or sensitive business processes. However, a common oversight during development is :</p><blockquote><em>💥 Developers forget to </em><strong><em>disable insert, modify, or delete operations</em></strong><em> on these archival or read-only records.</em></blockquote><p>This can lead to:</p><ul><li>Unintentional modifications to validated data.</li><li>Malicious tampering or errors by users.</li><li>Audit and compliance risks.</li><li>Inconsistencies in reports or downstream processes.</li></ul><h3>⚠️ Real Scenario</h3><p>Let’s say you create a Payment Request Header table and a related page. When a request is validated, it&#39;s moved to this historical table.</p><p>However, if the page allows users to:</p><ul><li><strong>Modify the amount</strong> or</li><li><strong>Change the status</strong> or</li><li><strong>Delete a row</strong></li></ul><p>… then your archived data is no longer trustworthy. Even worse, there might not be a record of who did it.</p><h3>🎯 The Goal</h3><p>Ensure that <strong>archived or historical data</strong> in Business Central is:</p><ul><li><strong>Read-only</strong> to the user.</li><li><strong>Locked</strong> against manual insert/update/delete.</li><li><strong>Secure</strong> through both UI (page) and backend (table triggers).</li></ul><h3>🔧 The Solution</h3><p>You need to implement protection at <strong>three levels</strong>:</p><h3>1. UI Level: Page Properties</h3><p>In your page definition (PageType = List or Card), you can set the following properties:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ANOLAq294heBgtlfSEwkuQ.png" /></figure><p>✅ This disables editing through the UI.</p><p>2. Table Level: OnInsert / OnModify / OnDelete Triggers</p><p>To protect against data changes <strong>via code </strong>secure the table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7NwUIkWxPK5OJrNZw0V8lw.png" /></figure><p>✅ This protects your data <strong>even if someone bypasses the page</strong>.</p><blockquote><em>ℹ️ You can use context-aware checks like </em><em>GuiAllowed, </em><em>IsInRole(), or custom </em><em>SystemPermissionSet checks if you want to allow </em><strong><em>internal insertions during archiving</em></strong><em> while blocking manual access.</em></blockquote><h3>3. Optionally: Permission Sets</h3><p>Create a custom permission set for archive tables:</p><ul><li>Deny insert/modify/delete unless used via controlled processes.</li><li>Use permission set filters to separate read-only access.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IWXNq4T3orkPgtffE_48xQ.png" /></figure><h3>✅ Bonus Tips</h3><ul><li>❄️ Use Editable = false on individual fields in pages if you allow read access but want to emphasize that data shouldn’t be changed.</li><li>📄 Add a caption or a notification bar on the archive page: &quot;This page is read-only. You cannot change historical payment requests.&quot;</li><li>🧪 Include this check in your <strong>code review checklist</strong> or <strong>AL extension design standards.</strong></li></ul><h3>🧪 Testing</h3><p>Make sure to test :</p><ul><li>Users can view but not edit from the UI.</li><li>Attempts to modify records via AL code throw proper errors.</li><li>Integration APIs (if exposed) also respect the read-only rules.</li></ul><h3>🔚 Conclusion</h3><p>Historical tables in Business Central are essential for ensuring auditability and data traceability. But they must be <strong>read-only and secure by design</strong>.</p><blockquote><em>✅ Always combine </em><strong><em>page-level restrictions</em></strong><em>, </em><strong><em>table-level validations</em></strong><em>, and </em><strong><em>permission sets</em></strong><em> to enforce data integrity.</em></blockquote><blockquote>If you’re building extensions that archive or freeze data after approval (e.g., payments, invoices, logs), make it a habit to <strong>lock down</strong> those records.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=667f7074968f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>