Posts

Create a zipped file using x++

 This article explains how we can create a zipped file in x++ and allow the file to be downloaded using the browser download. For this example, I am adding a csv file to a zipped archive. First we will need to create a stream with the contents for the csv file. CommaStreamIo streamIO = CommaStreamIo::constructForWrite();   streamIO.writeExp('Id', 'Title'); // These will represent the header of the csv file  streamIO.writeExp('001', 'Science'); // Row 1 streamIO.writeExp('002', 'Nature'); // Row 2 Next, we can generate the csv file contents and add it to a zip archive. // Get the stream System.IO.Stream        stream              = streamIO.getStream(); const str               extensionCsv        = '.csv'; c...

Generate and download a csv file using X++

Within Dynamics 365 HQ we often need to be able to export data as a csv file. This article explains how we can generate a csv file. The following lines of code can be used to create and download a csv file Create a writable stream. CommaStreamIo streamIO = CommaStreamIo::constructForWrite();   streamIO.writeExp('Id', 'Title'); // These will represent the header of the csv file  streamIO.writeExp('001', 'Science'); // Row 1 streamIO.writeExp('002', 'Nature'); // Row 2 // Get the stream System.IO.Stream        stream              = streamIO.getStream(); const str               extensionCsv        = '.csv'; stream.Position = 0; // StreamReader to read as str System.IO.StreamReader...

Creating a batch job with query based filter in D365 back-office

There are often business processes that requires us to run specific operations as a batch process. Dynamics 365 Head quarters (HQ) allows us to be able to periodically execute batch jobs. To create a custom batch job you need to extend the  RunBaseBatch class. The following lines of code show how we can create a simple export job.  class InvoiceExport extends RunBaseBatch {      Query                   query;     QueryRun                invoiceQueryRun; // QueryRun object that will be used to generate data for invoices to be exported.      DialogGroup             dialogGroupSetup; // This is a dialog group.     DialogField      ...

D365 POS extensions - Add extension properties to cart

Within Dynamics 365 for commerce there are often a need to add extension properties to existing objects. Adding extension properties to the cart object is often highly used. To add an extension property to the cart object in POS we can use the existing SaveExtensionPropertiesOnCartClientRequest/SaveExtensionPropertiesOnCartClientResponse pairs in POS to be able to update the cart. The following lines of codes can be used to add a simple boolean extension property to the cart object. var commerceProp = new ProxyEntities.CommercePropertyClass(); commerceProp.Key = "SampleExtProp"; var commercePropValue = new ProxyEntities.CommercePropertyValueClass(); commercePropValue.BooleanValue = true; commerceProp.Value = commercePropValue; let extensionProperties: ProxyEntities.CommercePropertyClass[] = []; extensionProperties.push(commerceProp); this.context.runtime.executeAsync(new SaveExtensionPropertiesOnCartClientRequest<SaveExtensionPropertiesOnCartClientResponse>(extensionPro...

Microsoft DevOps release pipeline

Image
In this article I want to go over how we can setup a simple release pipeline that can be used to automate LCS package deployment. This is a continuation of the previous article which explains how we can create a DevOps build pipeline for retail deployable package .   You will need to have access to DevOps pipelines to be able to complete this. Within DevOps, navigate to Pipelines > Releases Click 'New release pipeline' Select 'Empty job' Choose 'Add an artifact' Select the 'Project' and 'Source (build pipeline)' Update the required details as shown in the example below and click 'Add' Click on the job link Click on the Agent job tile and ensure that you select the correct agent pool and agent specification depending on your build machine configuration. Click the plus icon Choose 'Dynamics Lifecycle Services Asset Upload'. This step will copy your deployable package from the build pipeline artifacts and save it under the LCS ass...

DevOps build pipeline for Retail deployable package

Image
 This article explains how we can create a DevOps build pipeline to create a retail deployable package that can be applied to an LCS demo box. The following details are for a full retail deployable package that can be applied to a Tier 1 LCS environment. Follow the standard steps to create a pipeline and choose 'Azure pipelines and 'vs207-win2016' as agent pool and specification respectively. Next, ensure that you have update source control details and pointed to the correct mapping. Add the following details under agent job. Choose Add MSBuild to the pipeline and choose the dirs.proj located on the root of the RetailSDK folder. Copy the Retail binaries. Copy the Retail packages Copy files to staging directory Publish artifacts to packages

Upgrading Retail SDK extension to latest

Image
In the past couple of months, there have been a lot requests for upgrading Retail from one version to another. In this post, I will be describing how to upgrade RetailSDK from one version to another. For this exercise I am upgrading from 10.0.18 to 10.0.20. Ensure that your current dev branch for 10.0.18 has been mapped to your local. Get latest and ensure that there are no pending changes.  Apply 10.0.20 update package to the environment. Navigate to https://lcs.dynamics.com/ Select the environment that you need to update Choose Maintain > Apply Updates Select the 10.0.20 service package released by Microsoft. Choose Apply This will kick-off the update process once complete you will be notified via email or you can refresh the page to view progress and details. Retail SDK 10.0.20 package To get the RetailSDK 10.0.20 package, navigate to the K drive (referred to as SourceRepo)  for an LCS demo box. This may differ depending on the environment. Sometimes it is in the C drive...