Use of SETRANGE and SETFILTER in Dynamics 365

SETRANGE and SETFILTER in Dynamics 365: (1) For applying filters on tables in Business Central, use “SETRANGE” and “SETFILTER”. (2) SETRANGE is defined as applying a simple filter on a table. (3) SETFILTER is defined as applying a filter that you specify. (4) The difference between SETRANGE and SETFILTER is that in SETFILTER, you can use …

How to use CASE statement in D365 BC

CASE statement in D365 BC: (1) Definition- Case statements are typically used when you must choose between more than two different actions. (2) Syntax of “CASE” statement- case <Expression> of <Value set 1>: <Statement 1>; <Value set 2>: <Statement 2>;  <Value set n>: <Statement n>;  end; (3) Lets take an example, get name of the month from Date: (4) The <Expression> is evaluated, and the …

Skip Purchase Order Document deletion when it is fully posted

Skip Purchase Order Document deletion in Business Central: (1) Sometime business required Purchase Order Document in system when it is fully posted because in D365 BC purchase order document auto delete when it is fully posted. (2) For doing this, call “OnBeforeDeleteAfterPosting” event for skip purchase order document to delete. Source Code in AL: codeunit 50001 …

How to use FOR-TO loop statement in Microsoft D365

Use FOR-TO loop statement in Microsoft D365: Definition of “FOR-TO”:  Repeats the inner statement until a counter variable equals the maximum or minimum value specified. Syntax: “FOR-TO” statement- FOR <Control Variable> := <Start Number> TO <End Number> DO    <Statement> Let’s take an example- Assign a value to the ARRAY variable according to the number of records …