<?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"><channel><title><![CDATA[easyBC]]></title><description><![CDATA[easyBC]]></description><link>https://easybc.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 21:21:01 GMT</lastBuildDate><atom:link href="https://easybc.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[What Every BC Developer Should Know About SecurityFiltering in AL]]></title><description><![CDATA[If I were a Business Central developer just starting with AL, I'd want to quickly learn how security filters work in code and how to manage them.
In Business Central, permission sets and security filters determine what users can see. When writing AL ...]]></description><link>https://easybc.hashnode.dev/what-every-bc-developer-should-know-about-securityfiltering-in-al</link><guid isPermaLink="true">https://easybc.hashnode.dev/what-every-bc-developer-should-know-about-securityfiltering-in-al</guid><category><![CDATA[businesscentral]]></category><category><![CDATA[Security]]></category><category><![CDATA[ALcode]]></category><category><![CDATA[msdyn365bc]]></category><category><![CDATA[Business Central]]></category><dc:creator><![CDATA[TURKI Hela]]></dc:creator><pubDate>Sat, 21 Jun 2025 12:13:28 GMT</pubDate><content:encoded><![CDATA[<p>If I were a Business Central developer just starting with AL, I'd want to quickly learn how <strong>security filters</strong> work in code and how to manage them.</p>
<p>In Business Central, permission sets and security filters determine what users can see. When writing AL code, we can <strong>override</strong>, <strong>enforce</strong>, or <strong>validate</strong> these filters according to our needs. This is where the <code>SecurityFiltering</code> property becomes very useful.</p>
<h2 id="heading-how-to-add-a-security-filter-in-business-central">How to Add a Security Filter in Business Central</h2>
<ul>
<li><p>Step 1: Go to "Permission Sets"</p>
</li>
<li><p>Step 2: Select or create a Permission Set</p>
</li>
<li><p>Step 3: Add Table Permissions</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748269004855/6f5ec7b5-2552-4e68-80df-2fe5c4d6795a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Step 4: Add a Security Filter</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1748269075586/a83bc50c-cf96-4952-88a5-6f84fbbb2402.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-lets-learn-how-to-use-securityfiltering-in-al">Let’s Learn How to Use SecurityFiltering in AL</h2>
<p>  When building extensions in Business Central, it's important to control what data users can access, not only in the UI but also in the code.</p>
<h3 id="heading-syntax">🎯 Syntax</h3>
<h3 id="heading-securityfilteringsecurityfilter"><code>[SecurityFiltering(SecurityFilter)]</code></h3>
<h3 id="heading-var-customerrec-record-customer"><code>var CustomerRec: Record Customer;</code></h3>
<p>  The available values for <code>SecurityFiltering</code> are:</p>
<ul>
<li><p><code>SecurityFilter</code>: Enforces the user’s security filters (default behavior).</p>
</li>
<li><p><code>Filtered</code>: Enforces filtering based on the user’s security setup.</p>
</li>
<li><p><code>Ignored</code>: Bypasses all security filters on the record.</p>
</li>
<li><p><code>Validated</code>: Enforces the security filters and throws an error if filters are violated.</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-when-to-use-it">When to Use It</h3>
<ul>
<li><p>Use <code>SecurityFiltering(SecurityFilter)</code> or <code>Filtered</code> when you want to respect the user's data access.</p>
</li>
<li><p>Use <code>Ignored</code> only when it's necessary for system-level tasks and you’re sure you need full access to the data.</p>
</li>
<li><p>Use <code>Validated</code> when you want to explicitly ensure the code errors out if the current user shouldn't access that data.</p>
</li>
</ul>
<h2 id="heading-example">Example</h2>
<p>    You want to calculate <strong>total inventory across all locations</strong>, even if the user has a security filter on <code>Location filter</code></p>
<pre><code class="lang-basic">    procedure GetTotalInventory(ItemNo: Code[<span class="hljs-number">20</span>])
        var
            Item: Record <span class="hljs-string">"Item"</span>;
            TotalQty: Decimal;
        begin
            Item.SecurityFiltering := SecurityFilter::Ignored;
            Item.<span class="hljs-keyword">get</span>(ItemNo);
            Item.calcfields(<span class="hljs-string">"Inventory"</span>);
            TotalQty := Item.Inventory;
            Message(<span class="hljs-comment">'Total Quantity for item %1 = %2', ItemNo, TotalQty);</span>
        <span class="hljs-keyword">end</span>;
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Why use IsEmpty() ?]]></title><description><![CDATA[Use isEmpty() for quick checks ,and FindSet() for loops.
IsEmpty() checks whether a record variable contains any data.It returns true if the table has no records.
Avoid using FindSet() if you don't plan to process the data — it's heavier than you thi...]]></description><link>https://easybc.hashnode.dev/why-use-isempty</link><guid isPermaLink="true">https://easybc.hashnode.dev/why-use-isempty</guid><category><![CDATA[ALcode]]></category><category><![CDATA[msdyn365bc]]></category><category><![CDATA[isempty]]></category><category><![CDATA[Business Central]]></category><category><![CDATA[Records]]></category><dc:creator><![CDATA[TURKI Hela]]></dc:creator><pubDate>Mon, 26 May 2025 10:37:35 GMT</pubDate><content:encoded><![CDATA[<p>Use isEmpty() for <strong>quick checks</strong> ,and FindSet() for loops.</p>
<p>IsEmpty() checks whether a <strong>record variable contains any data</strong>.It returns true if the table has <strong>no records</strong>.</p>
<p>Avoid using FindSet() if you don't plan to process the data — it's heavier than you think!</p>
<h3 id="heading-syntax"><strong>Syntax:</strong></h3>
<p><code>IF MyRecord.IsEmpty THEN</code></p>
<p><code>Message('No records found!');</code></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>You want to…</strong></td><td><strong>Use this</strong></td></tr>
</thead>
<tbody>
<tr>
<td>Check if <strong>any record exists</strong></td><td><code>IsEmpty()</code></td></tr>
<tr>
<td><strong>Loop</strong> through records efficiently</td><td><code>FindSet()</code></td></tr>
<tr>
<td>Just get <strong>one record</strong> (e.g., the first)</td><td><code>FindFirst()</code></td></tr>
<tr>
<td>Process <strong>locked set</strong> (transaction safe)</td><td><code>Find('-')</code> or <code>FindSet(true)</code></td></tr>
</tbody>
</table>
</div>]]></content:encoded></item></channel></rss>