C# – Await and Async

In a previous post, we looked at the Task Parallel Library. In this post we will look at Await and Async in C#. In our previous example, when clicking a button we will wait 5 seconds, then display a message to the user, and without locking up the UI. We will tell our function that it will run asynchronously using the async keyword, and use await to tell the compiler … Continue reading C# – Await and Async

Adding an OnChange Script Programmatically in Dynamics 365 Power Apps

In this post, we will look at how to programmatically add an OnChange script in Dynamics 365 Power Apps, so when a user tabs off a field, the script is run. First, when we tab off a field, such as this fax field on the account record, we would like our script to run: Without doing this programmatically, we would select the field and select Change Properties: Then go to … Continue reading Adding an OnChange Script Programmatically in Dynamics 365 Power Apps

Upgrading to USD 3.3

In this post we will upgrade to USD 3.3. Below, under Settings->Solutions, we can see the versions for the USD solution and the UII solution: Download the latest USD package 3.3 package. We will first run the Package Deployer: Run the Package Deployer: Click Continue: And Continue: And select Unified Service Desk – Upgrade: Click Next: Click Next: Click Next: Click Next: Once complete, we will see the solutions have … Continue reading Upgrading to USD 3.3

Using ExecuteTransaction in Dynamics 365 C#

ExecuteTransaction can be used in Dynamics 365 to execute requests as a transaction. Here’s some sample code: [sourcecode language=”CSharp”] using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Tooling.Connector; using Microsoft.Xrm.Sdk; using Microsoft.Crm.Sdk.Messages; using Microsoft.Xrm.Sdk.Query; using Microsoft.Xrm.Sdk.Messages; using System.ServiceModel; namespace Carl.Dynamics365ExecuteTransaction { class Program { static void Main(string[] args) { try { var connectionString = @"AuthType = Office365; Url = https://yourorg.crm.dynamics.com/;Username=your@email.com;Password=yourpassword"; CrmServiceClient conn = new CrmServiceClient(connectionString); IOrganizationService service; … Continue reading Using ExecuteTransaction in Dynamics 365 C#

Update a Record using Xrm.WebApi

Let’s look at how we can use the Xrm.WebApi to update a record. Let’s use the Account entity, where we have a field called My New Field (new_mynewfield): Here’s the update script: [sourcecode language=”CSharp”] var data = { "new_mynewfield": "TEST" } var Id = Xrm.Page.data.entity.getId().replace("{", "").replace("}", ""); Xrm.WebApi.updateRecord("account", Id, data).then( function success(result) { console.log("Success"); }, function (error) { console.log(error.message); } ); [/sourcecode] We can run this in the browser console … Continue reading Update a Record using Xrm.WebApi

Get the Id of a Record on a Page in Dynamics 365 Power Apps

Let’s look at how to get the Id of a record in Dynamics 365 Power Apps using JavaScript. We can see below our Account record with the Id in the URL: To get the Id of the record in JavaScript, let’s run the code below, which Xrm.Page.data.entity.getId(); or by passing the formContext: formContext.data.entity.getId(); And to remove the curly braces: Xrm.Page.data.entity.getId().replace(“{“, “”).replace(“}”, “”); Or formContext.data.entity.getId().replace(“{“, “”).replace(“}”, “”);  

The App You’re Trying to Install Isn’t a Microsoft-Verified App

You may get the error message “The App You’re Trying to Install Isn’t a Microsoft-Verified App” when running an application that wasn’t downloaded from the Microsoft App Store. To resolve this, click on Change my app recommendation settings, or in Windows open Settings. Select the drop-down list for Allow apps from the Store only: We have several options: Set this to Turn off app recommendations: Relaunch your app. The message … Continue reading The App You’re Trying to Install Isn’t a Microsoft-Verified App

Increasing Email Attachment Size in Dynamics 365

In Dynamics 365, the maximum size of an email attachment defaults to 5120kB, or 5MB. Let’s look at how we can increase this. First, let’s create an email message and try to add a large attachment. Go to Activties and create a new Email: Add a new attachment: Click Choose File: Let’s add a PDF file: When we try to attach it, we get the message that “The attachment is … Continue reading Increasing Email Attachment Size in Dynamics 365

Coding Multiple Plugins in One Assembly in Dynamics 365

In this post we will look at how to code 2 plugins in one assembly. This might be useful if you want to keep related pieces of code under the same code base. Let’s create a new VS project: Rename the class to Plugins: Add Microsoft.CrmSdk.CoreAssemblies through NuGet. Add the code. We will add 2 functions, Plugin1 and Plugin2: The code will write a Plugin Trace Log entry. [sourcecode language=”CSharp”] … Continue reading Coding Multiple Plugins in One Assembly in Dynamics 365