Posts

Showing posts from March, 2022

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.