Tuesday, August 10, 2021

Dynamics 365 and Power Platform monthly reading list August 2021

 Power Platform and Dynamics 365 release wave 

Technical topics (Configuration, customization and extensibility)
Topics for Dynamics 365 Business Applications Platform/Power Platform consultants, project managers and power users

Monday, August 02, 2021

Leverage environment variables in Power Platform and Dynamics 365 projects

Environment variables allow you to easily add configuration data with Power Platform solutions  and use them in different solution components such as canvas apps, Power Automate cloud flows and model driven apps. Environment variables are a fairly new component type and were introduced in public preview in November 2019 and released in GA around summer 2020.  They are a good alternative for the typical custom "configuration entity/table" that you use in a project -  check out Why you should use environment variables for some practical experience around it.


The new solution import experience supports setting environment variables during the import of the solution but it will only do it when you did not set the default value or a current value so don't forget to remove the current value (click on the "..." next to the current value to remove before exporting your managed solution) as documented on Enter new values while importing solutions. On the target environment where you import your managed solution, you will see a red bar appearing if there are environment variables missing values.



You will be able to use the created environment variables within all different types of Power Platform components but so far I have used it mainly in Power Automate cloud flows where you can use environment variables in expressions  (see screenshot below) - see references section for other example use cases.





References:






Thursday, July 22, 2021

Dynamics 365 and Power Platform monthly reading list July 2021

Power Platform and Dynamics 365 release wave 2
Technical topics (Configuration, customization and extensibility)
Topics for Dynamics 365 Business Applications Platform/Power Platform consultants, project managers and power users

Monday, June 21, 2021

Quick tip: don't forget to unblock downloaded source code files when using Visual Studio

A couple of weeks ago, I suddenly received below exceptions when trying to build a VS2019 solution that I downloaded from Github. 


The solution is indicated in the exception - you need to right click the file and uncheck the "Unblock tickbox" at the bottom of the dialog. But when you have a lot of files, this is quite tedious. Luckily there is a PowerShell cmdlet Unblock-File to help you solve this. Navigate to the folder where you sourcecode is located and just run "dir -recurse | Unblock-File".




Friday, June 18, 2021

Quick tip: submitting web forms to Dataverse using Power Automate Cloud Flows

You can quite easily integrate data coming from forms on your web site with Dataverse using some simple  Javascript and Power Automate Cloud Flows. 

First step is to create a Power Automate Flow with a "When a HTTP request is received" trigger and add the form fields that you want to capture as JSON payload.  Remember to start creating your flow from within a solution so that you can leverage the ALM capabilities of Dataverse and use the new Dataverse connector (current environment)

The request body JSON schema should contain all the web form fields that you want to sent to Dataverse/Dynamics 365 - below is the JSON schema that I generated from a sample payload. 

{
    "type": "object",
    "properties": {
        "firstname": {
            "type": "string"
        },
        "lastname": {
            "type": "string"
        },
        "phone": {
            "type": "string"
        },
        "email": {
            "type": "string"
        },
        "message": {
            "type": "string"
        }
    }
}

After you save the flow - the "HTTP Post URL" will be automatically generated - this is the URL that you will be using in the Javascript code that you embed on your website to sent the web form  to Dataverse. You might want to consider using Azure API management to protect and expose the API indirectly. 

 

The last step is to  add the Javascript code snippet to your website to submit the changes to the Power Automate cloud flow endpoint or the Azure API management hyperlink.

function submitform()
	  {
		var emailvalue = document.getElementById('emailvalue').value;
		var firstnamevalue = document.getElementById('firstnamevalue').value;
		var lastnamevalue = document.getElementById('lastnamevalue').value;
		var phonevalue = document.getElementById('phonevalue').value;
		var messagevalue = document.getElementById('messagevalue').value;
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.open("POST","yourcloudflowurl");
		xmlhttp.setRequestHeader("Content-Type","application/json;charset=UTF-8");
		xmlhttp.send(JSON.stringify(
			{
				firstname: firstnamevalue,
				lastname: lastnamevalue,
				phone: phonevalue,
				email: emailvalue,
				message: messagevalue
			}
		));
		alert("Thank you");
	  }

Wednesday, June 16, 2021

Introduction to the Dual Write framework for Dynamics 365

Summary: The Dynamics 365 Business Applications Platform consists out of a number of different first party apps with CRM (Dynamics 365 Sales & Customer Service) and ERP (Dynamics 365 Supply Chain Management) being core components which typically are used cross industries and sectors in a large number of sectors. The Dual write framework allows for deep integration of Dynamics CRM and F&O.


In most application architectures at companies we have this classical divide between CRM software on the one hand and ERP software on the other hand. Different vendors, technology stacks make it difficult to bridge the divide between the processes and the data models in these core applications.


But from a customer perspective, they don't care about how your application architecture looks like and whether your processes need to cross application boundaries (see simplified schema below)


The Dual Write framework in Dynamics 365 is just one of the different integration mechanisms available in the platform but it probably is the one which provides the deepest level of integration. Dual-write is an out-of-the-box infrastructure that provides near real-time and bi-directional integration between model-driven apps in Dynamics 365 CE (and Dataverse) and Dynamics 365 Finance and Operations. Dual-write provides tightly coupled, bi-directional integration which offers a number of interesting functionalities (but is not necessarily a fit for your scenarios so it is important to do an assessment first of the impact both on sales and customer service processes and financial processes). Changes in CE  causes writes to FinOps and changes FinOps causes writes to CE, this automated data flow provides an integrated user experience across the apps. (See Dual write overview in Microsoft docs for more detailed information)

Dual-write was made general available (GA) in March 2020 and has been evolving at a rapid pace with monthly updates - see What's new or changed in dual-write.  It consists out of a number of entity maps which are provided out of the box by Microsoft but you can adapt or even extend these entity maps in Dynamics 365 FinOps.  In my opinion, the configuration and setup should typically be done by FinOps consultants/architects since the process and data model from ERP is the most complex one but a basic understanding of Dynamics 365 Customer Engagement is quite useful.

Enabling Dual-Write for existing Finance and Operations Apps is quite thoroughly documented but in my personal experience there were still some quirks during the setup that I did not expect (experience from last year):


After installing the Dual Write solution on Dataverse (or Dynamics 365 CE) you will see quite a lot of changes that you need to be aware of as a CE consultant or CE solution architect like:

  • Enhanced currency functions (FinOps and CE need to have the same currency precision - see Currency data-type migration for dual-write)
  • Changes in CRM will be propagated to Dynamics 365 FinOps using a large number of plugins, if a transaction fails in FinOps because of some missing data (or wrong configuration) your changes will not be saved in CRM.
  • Introduction of new concepts like company (legal entity in FinOps) & party
  • As part of the Integrated customer master, account numbers are now required and need to be filled in. There is no global number sequence across CE and FinOps. You need to handle the autonumbering in both apps and use a common pattern. Accountnumber in CR is mapped to Customer Account number in FinOps, it needs to be unique per legal entity and is the primary key of the customer table in FinOps.
  • Exposure to financial and tax data  in Dynamics 365 CE e.g. customer groups which are used in FinOps to share characteristics for companies such as payment terms, number of days until invoices are due etc... This is sometimes also used for intercompany invoicing for internal/external customers.
  • Advanced pricing and on hand inventory functions


References: