Archive for April, 2018

D 365 – ‘Voice of the Customer’ solution installation failed

Other day, I was getting solution installation failure error while installing “Voice of the Customer” on my trail instance.


Issue was persisting even after multiple retries.


  • I tried to install solution from “Manage your solutions” screen, which is the reason for failure (This approach used to work in CRM 2016 till Dynamics Version 9)
  • This is not the proper way of installing ‘Voice of the Customer’ solution from Version 9, as per the documentation available here


So the right way to install  ‘Voice of the Customer’ solution, from V9, is from ‘Applications’ tab of your ‘Dynamics 365 Admin Center’

  • Connect to your Office 365 Portal
  • Go to the Dynamics 365 Administration Center, and then select the Applications tab.
  • Select the application row titled Voice Of The Customer, and then select Manage.


  • In the next screen, pick your instance and click ‘Install’


  • To track the progress, go to “Dynamics 365 Administration Center“, Select the instance name, and then select Solutions.
  • The status is displayed in the Status column.

To know more on the usage of ‘Voice of the Customer’ solution, refer my article

Quick Notes:

  • Up on the ‘Voice of the Customer’ solution installation, a new “VOC Push Service user”  (Application User) is created automatically.
  • This Application User will allow Voice of the Customer Azure service to authenticate with Dynamics 365 using Server-to-Server (S2S) authentication.
  • As this “VOC Push Service user” is an “Application User” no additional license will be consumed.
  • To know more about S2S authentication with Application User, refer my article



D365 – Troubleshoot and Fix connectivity issues – ‘Microsoft Support and Recovery Assistant for Office 365’ tool

April 23, 2018 1 comment

Recently, I came across a Microsoft Support and Recovery Assistant for Office 365 tool from Microsoft to troubleshoot and fix Office 365 connectivity issues. Download

This tool can fix many problems for you, or it can tell you how to fix them yourself with guided steps.

Tool - 3

It helped me fixing my Dynamics 365 free trail connectivity issue and Outlook connectivity issue.


  • Download and open the .exe


  • Pick the App you have problem with.

Tool - 2



IntelliSense in Jscript/TypeScript file – Dynamics 365

April 16, 2018 1 comment

In this article, lets see how to configure intellisence with XRM syntaxes in your Jscript/TypeScript files.

To enable IntelliSence, you need to install xrm npm package to your Visual Studio.

Steps to install NPM package:

  • To install npm package, you need to download and install a Visual Studio extension : Package Installer

Intelli - 5

  • Post installation, from your Visual Studio, select ‘Quick Install Package’ from Menu

Intelli - 6

  • From the popup,
    • Select ‘npm’ in the dropdown
    • In the textbox, type ‘@types/xrm
    • Click on ‘Install’

Intelli - 7

  • Post package installation, refresh the project and you should see a new folder ‘node_modules
    • Note: If you dont get the ‘node_modules’ folder, check your project’s physical location and add the folder to your Visual Studio project.

Intelli - 8

  • In above screen, ‘TypeScript’ is my project name and post above steps, I got the ‘node_modules’ project.

Enable IntelliSence in your Jscript/TypeScript file:

  • Open your script file
  • Drag and drop the ‘index.d.ts’ file from ‘node_modules’ folder on to your script file.
    • Alternatively you can also this syntax
      • /// <reference path=“../node_modules/@types/xrm/index.d.ts />

Intelli - 1

  • Start typing ‘Xrm’ and you should see the syntaxes.


  • Those who are wondering what is a npm, it is a package manager for the JavaScript programming language.
  • hosts thousands of free packages to download and use.


Transaction aware batch processing using ‘ExecuteMultipleRequest’

April 10, 2018 4 comments

In this article, I am going to discuss about transaction aware batch processing in ExecuteMultipleRequest using  ExecuteTransactionRequest.

Is ‘ExecuteMultipleRequest’ not a transaction aware?

  • By design, ‘ExecuteMultipleRequest’ is non-transactional.
  • Which means ‘Request’ objects added to ‘ExecuteMultipleRequest’ are independent of each other and if any exception occurred in any of the ‘Request’ will not roll back previously committed ‘Requests’.
  • However you have an option to stop the batch (i.e., By setting ContinueOnError = false),  if any exception occurs.
  • Important to note is that, this behavior is not a transaction aware and ‘Requests’ executed prior to the error, will still be committed.

How can we achieve ‘Transaction’ in Batch execution?

  • Using ExecuteTransactionRequest, we can achieve ‘Transaction’ (i.e., Commit and Rollback) in Batch execution
  • ExecuteTransactionRequest will execute the all the ‘Requests’ in a single transaction.
  • If any exception occurred in any of the ‘Request’ execution, will roll back all the previously executed ‘Requests’.

Then why do we need ‘Transaction aware’ feature in ‘ExecuteMultipleRequest’?

  • ‘ExecuteMultipleRequest’ has an option to either stop the operation or suppress the exception, if any exception occurs, using ContinueOnError property.
  • However there is no option to achieve ‘Transactional Batch feature’ in ExecuteMultipleRequest.

Lets see how we get both features together in ‘ExecuteMultipleRequest’?

[Code snippet] ‘ExecuteMultipleRequest’ with ‘Transaction aware’ option

  • ‘ExecuteMultipleRequest’ can have ‘ExecuteTransactionRequest’ object as a ‘Request’, and as we know ‘ExecuteTransactionRequest’ is transaction aware, it get executed in transaction.

var connectionString = ConfigurationManager.ConnectionStrings[“Xrm”].ConnectionString;
CrmServiceClient crmConn = new CrmServiceClient(connectionString);

// Instantiate ExecuteMultiple
var reqExecMultiple = new ExecuteMultipleRequest(){
Requests = new OrganizationRequestCollection(),
Settings = new ExecuteMultipleSettings(){
ContinueOnError = false,
ReturnResponses = true

// Instantiate ExecuteTransaction
var reqExecTransaction = new ExecuteTransactionRequest(){
Requests = new OrganizationRequestCollection()

// Add 20 requests of type ‘CreateRequest’ to ‘Execute Transaction’
for (int indxStudent = 0; indxStudent < 20; indxStudent++){
// Instantiate ‘Student’ record
var entStudent = new Entity(“new_student”);
entStudent[“new_name”] = “Student : ” + indxStudent.ToString();

// Instantiate ‘CreateRequest’
CreateRequest reqCreate = new CreateRequest{
Target = entStudent

// Add ‘CreateRequest’ object to ‘ExecuteTransaction’ Requests collection

// Execute the ‘Execute Multiple Request’
using (_serviceProxy = crmConn.OrganizationServiceProxy){
_service = _serviceProxy;

// Add ‘Execute Transaction’ request object to ‘ExecuteMulitple’ Requests collection

// Execute Multiple Request
var response = (ExecuteMultipleResponse)_service.Execute(reqExecMultiple);

// Read the GUID of created Students
foreach (var responseItem in response.Responses){
var execTransactionResponse = (ExecuteTransactionResponse)responseItem.Response;
foreach (var createResponse in execTransactionResponse.Responses){
Console.WriteLine(“Student created: {0}”, ((CreateResponse)createResponse).id);


Key Notes:

  • ‘ExecuteTransactionRequest’ cannot contain either ‘ExecuteTransactionRequest’ or ‘ExecuteMultipleRequest’ messages.
  • Its recommended to not use ‘ExecuteTransactionRequest’ or ‘ExecuteMultipleRequest’ in Plug-ins. Refer article.
  • Operations included in a batch request are executed sequentially and aren’t done in parallel.
  • ‘ExecuteTransactionRequest’ may potentially block the database for the duration of the long-running transaction, so use it judiciously.


Dynamics CE – Demystify ‘Auto Number’

April 6, 2018 3 comments

Auto Number‘ feature is available with Dynamics 365 (online) and V9.x versions. With this feature we are no longer dependent on 3rd party ISV solutions for Auto numbering.

Auto Number - 2

In this article I am going to cover a few use cases of Auto Number fields.

How to create an Auto Number field:

As of the date, we can either create a new ‘Auto number’ field or convert an existing field to ‘Auto Number’ only programmatically (i.e., using SDK call).

Creation of an ‘Auto Number’ from Application will be included in next releases.

Lets see how to create a brand new ‘Auto Number’ field and convert an existing ‘Single Line Of Text’ field to ‘Auto Number’ along with few key points.

[Code Snippet] Create a NEW auto number field:

Below is the sample code to create a new Auto Number field ‘new_studentnumber‘ in a custom entity ‘new_student

var studentNumberAttributeRequest = new CreateAttributeRequest{
EntityName = “new_student“,
Attribute = new StringAttributeMetadata{
//Define the format of the attribute
AutoNumberFormat = “STD-{SEQNUM:4}”,
// Set fields Logical and Schema Name
LogicalName = “new_studentnumber“,
SchemaName = “new_studentnumber“,
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
MaxLength = 100,
// Set fields Display Name and Description
DisplayName = new Label(“Student ID”, 1033),
Description = new Label(“Student ID”, 1033)

  • Make sure you ‘Publish‘ customization’s from Application after executing the code.

[Code Snippet] Convert EXISTING field to an auto number field:

Below is the sample code to convert OOB ‘new_name’ field to auto number field in the custom entity ‘new_student‘.

Important note:

  • Field you are converting has to be of type ‘Single Line Of Text’.
  • If you pass a different type of field (Ex- Whole number), code will not throw any exception but no auto number logic will get attached to the field.

// First retrieve the Attribute Metadata
var attributeRequest = new RetrieveAttributeRequest{
EntityLogicalName = “new_student”,
// Pass the attribute name
LogicalName = “new_name”,
RetrieveAsIfPublished = true

// Retrieve attribute response
var attributeResponse = (RetrieveAttributeResponse)_serviceProxy.Execute(attributeRequest);

// Now modify the retrieved auto-number attribute
var retrievedAttributeMetadata = attributeResponse.AttributeMetadata;
// Set the auto numbering format
retrievedAttributeMetadata.AutoNumberFormat = “STD-{SEQNUM:3}-{RANDSTRING:6}”;

// Update the auto-number attribute
var updateRequest = new UpdateAttributeRequest{
Attribute = retrievedAttributeMetadata,
EntityName = “new_student”,

// Execute the request

  • Make sure you ‘Publish‘ customization’s from Application after executing the code.

Key Points:

  • Auto number fields will be Read-only and you cannot override the value from Form.
  • But you can override the value from code using SDK Insert call.
  • As you would notice below, Even though the ‘Name’ is an Auto number field, I could create a ‘Student’ record from code by setting ‘Name’ to ‘Rajeev’.  If you dont set a ‘Name’ field value from code, system would populate the auto number.

Auto Number - 1

  • In a single Entity, you can have multiple auto number type fields with the same format.
  • You can alter the auto number format of a field at any point of time by using ‘UpdateAttributeRequest’ SDK call (Refer 2nd code snippet above).
  • In the Auto number format, use ‘Random String’ tag (i.e., {RANDSTRING:number}) which help you to avoid duplicates or collisions, especially when offline clients trying to create auto-numbers.
    • For example, CNR-{RANDSTRING:4} format will generate an auto number with a random string of 4 character length (i.e., ‘CNR-WXYZ‘)

Auto Number - 3

  • The random string placeholders are optional.You can include more than one random string placeholder in an Auto Number Format.



Dynamics Portal Caching issue – Missing ‘Clear Cache’ button

As you are aware, to clear the cache in ‘Dynamics Portals’, you need to login with a Portal user with ‘Administrators’ web role and

  • Navigate to {Portal_url}/_services/about.
  • Click on ‘Clear Cache’ button

But what if you don’t see the ‘Clear Cache’ button, even if you logged in with ‘Administrators’ web role?

We encountered the same and were getting a blank screen when we browsed ‘_Services/about’ by logging in with ‘Administrators’ web role.

Portal-Cache ClearReason:

  • Even though you are having ‘Administrators’ web role, you may be missing ‘Website Access Permissions’


Grant the missing ‘Website Access Permissions’ to ‘Administrators’ web role by following below steps.

  • Open your Dynamics application
  • Go to ‘Advanced Find -> Web Roles’

Portal-Cache Clear - 6

  • Open the ‘Administrators’ web role
    • Note : If more than 1 Portal solution (i.e., Custom Portal, Self service portal etc..) enabled, you will see more ‘Administrators’ records. Make sure you filter with ‘Website’.
  • From the navigation, open the ‘Website Access Permissions’

Portal-Cache Clear - 3

  • If no existing records in ‘Website Access Associated View’, create a new record (Note: If there is existing record, open the same)

Portal-Cache Clear - 4

  • In the new record window, select all the checkboxes under ‘Permissions’ section.

Portal-Cache Clear - 5

  • Save and Close.
  • Now from the Portal, browse {Portal_url}/_services/about
  • You should get the Portal Details screen with ‘Clear Cache’ button.

Portal-Cache Clear - 7


Dynamics Portals – ‘Record Mover’ and ‘Code Editor’ Tools – XrmToolBox

If you are a Dynamics Portal developer, couple of pain points you would have experienced, are

  • Moving configurations from environment to other
  • Navigating among multiple screens (Web Pages/Templates/Files etc…) to edit the configurations.

Lets see how these are addressed with below tools from our favorite XrmToolBox

  • Portal Records Mover
  • Portal Code Editor

Portal tools

Portal Records Mover:

To move the Portal configurations from environment to another, you might have used OOB “Configuration Migration Utility” tool but this tool has limitation as listed below.

  • You cannot choose records (For example, only specific Web Templates) as it would export all records for chosen entities.

With the ‘Portal Records Mover tool, now you can pick the sub set of records from Portal entities and you can apply Date filters and many more.

Usage steps:

  • From your XrmToolBox, connect to Portal Records Mover tool to your Dynamics instance.
  • Click on ‘Load Items’ , which load all Portal related entities.
  • From the “Options” tab,
    • Apply Date filters, if you want
    • Pick the ‘Web Site’, if you have multiple Portals (Custom Portal/Dealer Portal/etc..) installed

Export Records:

  • Choose the Portal Entities from left pane, you would like to migrate records from.
  • Click ‘Retrieve record’, to load the records from selected Portal entities.
  • Pick the records, you would like to migrate.

Portal Mover

  • Once you completed the record selection, click on “Export Records”
  • Choose the location to save the XML file.

Portal Mover - 2

  • XML file contain the records you selected.

Portal Mover - 3

Import Records:

  • To import the portal configuration to a Dynamics instance, you must have the XML prepared as mentioned above.
  • Click ‘Import records’ button and provide the portal configurations XML file.

Portal Mover - 4

Portal Code Editor:

This tool provides an easy way to edit all your Portal configurations in one place.

Note: This tool only works for Dynamics Portals and does not support ADX portals.

Usage steps:

  • Connect to Portal Code Editor tool to your Dynamics instance.
  • Click on ‘Load Items’ , which load all Portal related entities group by categories (i.e., Web Pages/Entity Forms/…).
  • Pick the record you want to update.
  • Modify the content and click ‘Save’ from ‘File’ menu.

Portal Code Editor

  • ‘Save’ just saves the content in Editor
  • To apply changes to your Dynamics instance, click on ‘Apply change to portal’ button

Portal Code Editor 2


  • Make sure you have the latest XrmToolBox downloaded, if you don’t find these tools.

Thanks to Tanguy TOUZARD for these amazing tools.