Posts

Showing posts from 2022

Disable sales order invoice data caching while developing data changes

Image
The sales order invoice will cache report data to improve performance which will result in data generation modifications that are implemented don't come through after the second print of the report unless the caching is disabled or cleared between each report print.   An easy quick way to disable the caching is to add a CoC extension to disable it while working on the report. Create a CoC on SalesInvoiceDP.useExistingReporData() and return false. Just make sure you don’t check in the SalesInvoiceDP.useExistingReporData() CoC method at the end of your work.   

Working with internal access modifiers and X++

Image
MS recently anncounced that they are changing the default class access modified to internal  to follow the C# practise for X++. Read more here This is not as scary change, it just means that the public access will be limited, narrowing down the possible calls you can make between models if you choose to use the default access modifier.  Internal  classes and methods work like public but are restricted to usage by other objects inside the same model. A model can be configured to expose all internal objects and methods to another model.  For example, below the internal class can only be used inside the model in which it's declared or by a model to which the model containing class have been exposed. Same applies to the internal method.  internal class HelloWorldCanOnlyBeUsedInsideModel { public static void main(String[] args) { System.out.println("Hello World!"); } } public class HelloWorld { internal static void mainCanOnlyBeCalledInsideModel(Strin

Calling the LCS API in your Azure DevOps pipeline to start and stop environments

Any easy cost saving mechanism for Dynamics 365 for Finance and Operations projects is to implement start and stop of cloud self hosted environments in LCS.  Many projects implement this by directly through Azure Portal. With this approach the deployment status of the environment isn't reflected correct in LCS. There is a risk that the environment is stopped when it's in a state which could cause a problem if the VM is stopped. For example, in the middle of a deployment.  An easy way to start/stop environments is to use the LCS API for environment status with the start/stop. To implement this use the code snippet below. 1. Create a pipeline in your DevOps with a PowerShell task 2. Choose inline script 3. Copy in the script, replace the credential variable values with your details.  3. Setup a schedule for your pipeline to run the script automatically.  LCS Environment status API LCS Environment start/stop This work was based on the original work of Ariste Calling the LCS Data

X++ Integration testing and performance consideration

MS provide the ATL framework for performing integration testing using X++ code and the SCM team is continuously releasing new ATL models for work that they are involved with. The ATL framework is a great tool but not that effective from a performance perspective.   To achieve better performance when executing your test make sure to group the tests together in a test class based on the data setup that is required. Place as much of the joined data setup code in the setUpTestCase () method. That way the code will only execute the data setup once.  

How to disable auto enabled flight key using KillSwitch

Image
Microsoft is introducing new functionality into Dynamics 365 for Finance and Operations with flight keys in every other new release. For this they use  Flight  classes so that the changes are automatically applied and can be reversed.  Example of a flight class that control the functionality of a new set of functionality.  When a flight key that enable functionality can be found in the flight key table  SysFlighting To disable the functionality don't delete or change the enabled flag on the flight record, instead insert a KillSwitch  record. The KillSwitch record will ensure that the flighed functionality will stay disabled as long as it exist in the flight table.  In an environment that Microsoft maintain can raise a support ticket in LCS to disable specific flight keys.  SQL statement for insert the KillSwitch record.  DECLARE @flightName NVARCHAR(100) = 'WHSWorkCancelForcedFlight_KillSwitch' IF NOT EXISTS (SELECT TOP 1 1 FROM SysFlighting WHERE flightName = @flightName