Category Archives: Uncategorized

Dynamics 365 v9.0: String (RESX) Web Resources – A Better World with Localization

Hello everyone,

In today’s post I would like to discuss about the feature introduced in Dynamics 365 v9.0 with which complete localization can be achieved. If we take a look back at prior versions of CRM, localization can be achieved for Entities and it’s sub components using “CrmTranslations.xml” file in the solution. However, there is no OOB support for achieving the same for custom web resources like JScript and HTML. With introduction of “String (RESX) Web Resources”, we have got complete package of localization solution.

Before jumping into more details, we need to understand another feature introduced in Dynamics 365 v9.0 which is required in order to make String Web Resources work. In my prior post, i touched up on using Attribute dependencies for JScript web resources. Similarly, we also got Web Resource Dependencies introduced. Let’s quickly understand this feature. For an instance, we have JScript web resource named “new_servicehelpers.js” which uses JQuery and JSON libraries. In prior versions of CRM, in order to use “new_servicehelper.js” on a form we require to add JQuery and JSON JScript web resources as well on the form libraries. This is one of the tough task developer has to undergo in order to keep track of dependent web resources and their order of loading. With v9.0 on wards, we can simply add JQuery and JSON web resources as dependencies for the “new_servicehelper.js” web resource by adding them to “Dependencies” tab’s first grid. By doing this, CRM will automatically download JQuery and JSON web resources wherever “new_servicehelper.js” is about to load on a form. In one of my previous implementations, we used require.js library to achieve modular and dependency file loading. Now, we got it this OOB. Later in this post, i will show how we can use the same concept for String Web Resources.

So, lets start looking into what is a String Web Resource, how to create and use it in the other web resources. For this post, I will be focusing on using String Web Resources in JScript Web Resources.

At a high level, following are the quick bits about working with String Web Resources:

  1. String Web Resource’s file extension is .resx and uses RESX XML which holds keys and localized strings. This is the standard format used across windows applications.
  2. String Web Resources has to follow a standard naming convention. It’s format is webresourcename.languagecode.resx. ex: new_text.1033.resx
  3. For same content, separate String Web Resources has to be created for each language.
  4. Add String Web Resources as Web Resource Dependencies to JScript Web Resources.
  5. Use Xrm.Utility.getResourceString(webResourceName, key) to get the localized string based on the current logged in user’s language code.

Creating .RESX file:

As i mentioned earlier, RESX XML is the standard format used across windows applications. So, lets go to Visual Studio and find out how to create it in a simple way.

  1. Add a Resource File as shown below to one of your existing or a new project. We don’t need to follow CRM standard naming convention for String Web Resources here for this .resx file in Visual Studio but I suggest we follow that here as well.
    My bad: I could have named this file as “new_Messages.1081.resx”


2. Open Designer view of newly created Resource File and add keys and respective localized strings. Following is the Resource File i created for “Hindi” language. Comments are optional.


Following is the auto generated RESX XML code generated for this file. No need to check what has been written in this XML file. Save your time for other important things.!!

<?xml version="1.0" encoding="utf-8"?>
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.


... headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/">
<value>[base64 mime encoded serialized .NET Framework object]</value>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/ is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
<xsd:schema id="root" xmlns="" xmlns:xsd="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:element name="value" type="xsd:string" minOccurs="0" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
<xsd:element name="assembly">
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:element name="data">
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
<xsd:element name="resheader">
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" />
<resheader name="resmimetype">
<resheader name="version">
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="ApprovalConfirmRequest" xml:space="preserve">
<value>Do you really want to approve this request?</value>
<comment>Approval Confirmation Dialog </comment>
<data name="ApprovalReject" xml:space="preserve">
<value>Request is Rejected</value>
<comment>Approval Rejection Message</comment>
<data name="ApprovalSuccess" xml:space="preserve">
<value>Request Approved Successfully</value>
<comment>Approval Success Message</comment>
<data name="CancelButtonLabel" xml:space="preserve">
<data name="ConfirmButtonLabel" xml:space="preserve">
<data name="GotIt" xml:space="preserve">
<value>Got it</value>
<data name="SubTitle" xml:space="preserve">
<value>This action will approve the request</value>
<comment>This action will approve the request</comment>
<data name="Title" xml:space="preserve">
<value>Approval Request</value>
<comment>Approval Request</comment>

3. Create a new String Web Resource in CRM. Here are the important things to consider.

  • Use Standard naming convention. For this web resource, i named it as “new_Messages.1081.resx”. 1081 is the language code for Hindi. For a list of language codes, please check this link
  • Select Type as “String (RESX)
  • Select appropriate language in the Language dropdown. For this web resource, i have selected “Hindi (India).
  • Choose .resx file created in Visual Studio. As of we don’t have an option to view/update RESX web resource content within CRM. So, any changes has to be done has to happen in Visual Studio for now. So, better if we follow the CRM naming convention in Visual Studio project as well.


4. Similarly, I am creating one more RESX web resource for English with same keys but with english strings.

Name of the web resource: new_Messages.1033.resx.

We require to keep the name similar except the language code which is 1033. The reason being, we would like CRM to auto load either of these files based on user’s language code.



5. Now, lets add these newly created two String Web Resources as dependencies to JScript Web Resource. In one of my previous post, i have used JScript to show Confirm and Alert dialogs using Xrm.Navigation methods. Check out the post here . I will use the same JScript web resource and update it to use String Web Resources to show localized content.

Here is the updated JScript code to use:

function GetResourceString(webResourceName, key) {
return Xrm.Utility.getResourceString(webResourceName, key);

function ApproveRequest() {
var reqTitle = GetResourceString("new_Messages", "Title");
var reqText = GetResourceString("new_Messages", "ApprovalConfirmRequest");
var reqSubtitle = GetResourceString("new_Messages", "SubTitle");
var reqConfirmButtonLabel = GetResourceString("new_Messages", "ConfirmButtonLabel");
var reqCancelButtonLabel = GetResourceString("new_Messages", "CancelButtonLabel");
var confirmStrings = { title: reqTitle, text: reqText, subtitle: reqSubtitle, confirmButtonLabel: reqConfirmButtonLabel, cancelButtonLabel: reqCancelButtonLabel };
var confirmOptions = { height: 200, width: 450 };
//New v9.0 Method
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(successCallback, errorCallback);

function successCallback(success) {
var approvedText = GetResourceString("new_Messages", "ApprovalSuccess");
var rejectedText = GetResourceString("new_Messages", "ApprovalReject");
var okText = GetResourceString("new_Messages", "GotIt");
//On Click on Approve Button
if (success.confirmed) {
//Here Logic to Approve the Request
var alertStrings = { confirmButtonLabel: okText, text: approvedText };
var alertOptions = { height: 120, width: 260 };
//New v9.0 Method
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);
else {
var alertStrings = { confirmButtonLabel: okText, text: rejectedText };
var alertOptions = { height: 120, width: 260 };
//New v9.0 Method
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);

function errorCallback(fail) {
//On Error Logic

Important changes done in this JScript web resource:

  1. Used Xrm.Utility.getResourceString(webResourceName, key) method to get the localized string.
  2. Used first part of the web resource name new_Messages and excluded remaining .languaguecode.resx part of it as the first parameter to the method. Reason for this obvious. We expect CRM product to auto select appropriate RESX file based on the user’s language. So, as a developer we need to pass the first part of the web resource name which is common for all language files and let CRM fills the language code and choose the appropriate one.

6. As shown below, under Dependencies tab for the JScript web resource add the RESX web resources in the first grid. Care to know about what’s in the second grid? Check out my previous post here


That’s it. We are done. Following is the result:

In Hindi(Indian)



In English:



Few more things to know:

  1. Organization’s default language is the fallback language option for RESX web resources. Let’s say my organization’s default language is English and I enabled Hindi and French as other available languages. With our current customizations in this post when a user with French language logs in, English RESX file will be loaded for them.
  2. For a No Key Found Scenarios where a key is not available in the loaded RESX file, a null value will be returned.


Hope it helps..!!!

How – To Series 16: UR 12 – Downside of Auto Save feature

Update: This issue is fixed now with MS CRM 2013 Org Level Setting. Following is the update: all,
UR 12 has introduced a nice feature called “Auto Save” which will save the CRM Records(only Process Driven UIs) in the background automatically when it get updated by the user in UI.

When a field value changed by user, in the bottom right corner a label as “Unsaved Changes” gets displayed:

After few seconds(15-20 sec), forms gets saved automatically:

From usability point of view, it’s a very nice feature… then what’s going wrong??

When I came to know about this feature, few things came to my mind:

Scenario1: Lets say I have registered a workflow or a plugin on “onChange” of a field called “fax” in “account” entity. User has entered some value(1234) in the “fax” field and went on to fill other fields. After few seconds(lets say 20 sec) form gets saved automatically in the background. Incase if user feels he entered some wrong value in “fax” field so he/she modified the field again.

Prior to UR12 or with Classic Forms: User saves the form manually. Even though user modifies the same field twice, field value gets saved to the database once(in one transaction). And the workflow which is registerd will fire once and completes it’s tasks.

with UR12 Process Driven Froms: As user modifies the same field twice(one before the auto save and one after the background save), field value gets saved to the database twice(in two transactions). And the workflow which is registerd will fire twice…..

Scenario2: Lets say I have registered a workflow or a plugin on “onChange” of fields called “fax” and “email” in “account” entity. User has entered some value(1234) in the “fax” field. After few seconds(lets say 20 sec) form gets saved automatically in the background. Then user modifies the “email” field. After few seconds form gets saved in the background

Prior to UR12 or with Classic Forms: User saves the form manually. workflow will be triggered only once.

with UR12 Process Driven Froms: As user modifies two fields (one before the auto save and one after the background save), two field values gets saved to the database in two different transactions. And the workflow which is registerd will fire twice…..

To verfiy that, I have registered a workflow on “fax” and “email” field. Added a step to attach notes with fax and email field vlaues:

Result after Scenario 1:

Workflow instances:

Created Notes:

Created Notes when fax got updated to 1234

Created Notes when fax got updated to 1234567

In the same manner, for the second scenario too workflow got triggered twice…

Is it the expected behavior??? or Is it a design glitch??? or something am I missing??? So, if we gonna use Process Driven forms then what should be the considerations for extending the entity behavior??

Fingers Crossed….!!! 🙂

Share me your thoughts…!!!

How – To Series 15: UR 12 – How to enable Process Driven Forms

Hi all,
The most feature rich release(Polaris) post CRM 2011 has already been out and excited to see the same applied on my CRM online instance. Following is the snapshot of CRM 2011 in Chrome Browser.CRM Online(Polaris) Landing Page:

Account Home Page Grid:

Account Form:

Few observations:

1. As expected, “Areas” in Left Navigation Pane doesn’t have icons.
2. “Resource Center” still exists as it should not(we will come to know when it will be removed)
3. In “Account” grid, “account” icon column has been removed.
4. Coming to Ribbon, disabled ribbons are greyed but still retaining their icon colours.
5. Tab text colour changed to light blue and size got decreased.
6. No divider line between header and body
7. New icons(refresh, arrow buttons etc..)
8. Significant control highlighting with border when it get focused
9. And the notable difference is in “Notes” Section:

Now, we can type notes text and upload an attachment at one go whereas earlier it used to be one after the other.

Overall at first glance you can find certain CSS changes. In order to find exact CSS changes I downloaded the SDK v5.0.13 for polaris & UR12 . However, the visual style guide doesn’t include the latest CSS changes. Is it a miss in the package??

Now, lets come to the main course…where are the Process driven UI for Account, Contact and Opportunity entities? As we heard it earlier that there will be a new form for each entity(Account, Contact and Opportunity)which will have same name as their entity schema name. However, in the above account form, you don’t see it having an option to select another form. As most of you might have already know that we need to explicitly enable this feature so as customer will have the flexibility to choose when they require this. Remember once this feature is enabled we cannot revert it.

To enable, navigate to “Settings->Administration->Product Updates and click on “Update” button

It will take few minutes to install the updates. Once it gets installed, you will see the following content:

Installation process actually involves in creating the new UI forms, a new entity called “Process Configuration”, appropriate assignment of privileges and all the required components for them.  However, the new UI forms won’t contain all the customization whichever we have done prior to UR12. So, we need to migrate them manually(First point in the above screenshot talks about that). As I am having a new CRM instance which doesn’t have any customizations, I am good to go and use the new UI forms as is. Again, you are not yet done. Click on the second link(Enable the new forms) to enable the new UI feature.

Refresh your page and you can see that “Resource Center” Area has been disappered.

Account Form(Process driven):

Contact Form(Process driven):

Opportunity Form(Process driven):

Getting a taste of Metro Style design app in CRM…???

There are lot more stuff of UR 12 to try out… Happy CRMing..!!! 🙂

Hope it helps..!!! 🙂


Post Sync Plugins not allowed for certain System entities?

I was getting some errors when trying to associate some records on creation of “User” and “Team” entities. I have registered “Post – Sync” step for those plugins.Getting following error for “Post” “Sync” plugin on “User” creation:
Error: usersettings with Id Does not Exist.


Getting following error for “Post” “Sync” plugin on “Team” creation:
Error: Generic SQL Error.

Changing them from “Post – Sync” to “Post – ASync” resolved the issue. It looks like SQL Locks might be causing the issue. There may be few more System entities for which the same is applicable. There is no documentation available specifying for which System entities creation “Post – Sync” plugins are not allowed. So, next time if you get any of the above errors for any of the other entities then try to change it to “ASync” and see whether it resolves your issue.

Hope it helps..!!! 🙂

Hidden Security Role in MS CRM….!!!????

     Recently I was trying to assign all the available Security Roles in a Business Unit to a particular User using following Code:

     private void AssignSecurityRoles(IOrganizationService service, Guid userId)  
       QueryExpression query = new QueryExpression  
         EntityName = "role",  
         ColumnSet = new ColumnSet("name")  
       EntityCollection roles = service.RetrieveMultiple(query);  
       EntityReferenceCollection entityRefCln = new EntityReferenceCollection();  
       foreach (Entity entity in roles.Entities)  
       service.Associate("systemuser", userId, new Relationship("systemuserroles_association"), entityRefCln);  

To my suprise, I received following error: “The Support User role cannot be assigned to a User”

After debugging the code, I found that there is one role called “Support User” security role present in the list of retrieved security roles. I never seen this role in the CRM UI so quickly went through the CRM UI app and to my surprise it is not available. However, it is present in the SQL Server… !!! Doesn’t it mean it’s a hidden role???? Not aware of the actual purpose of this role. As per SDK documentation, “A user who is a customer support engineer” is the description for the Security Role.

I added an additional conditional to avoid associating “Support User” security role for the time being. Anyone has an idea about the purpose this Security Role????

How – To Series 13: How to Hide System Chart or User Chart Name in Dashboard

Hi all,
I have worked on one of the requirement to hide lables of all charts(System or User) in all the dashboards. This requirement has been done more than once for different instances. Thought of sharing so that it will be helpful to someone.         By default, Chart Name and view Name will be shown in every chart when it is displayed in a dashboard as follows:

Inorder to hide the chart lable, I thought of going with the following appraoch
              In Post Stage of chart retrieval, replace the chart name with an empty string.

Pluing Code:

public void Execute(IServiceProvider serviceProvider)

// Get the context

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

// Check the required pre-requisits; if not, exit
if (!(context.MessageName.ToLower() == “retrieve” && (context.PrimaryEntityName.ToLower() == “savedqueryvisualization” || context.PrimaryEntityName.ToLower() == “userqueryvisualization”)))

// Get the chart entity
Entity entity = (Entity)context.OutputParameters[“BusinessEntity”];

//Replace the chart name with empty string.
if (entity.Attributes.Contains(“name”))
entity.Attributes[“name”] = string.Empty;

As chart can be either System or User so register the plugin on following two steps:


Once plugin is registered, following is the result:

I have also shared the code here
Hope it helps..!!! 🙂


Reserved Organizations in MS CRM…!!!!!

Today I got the following error when I tried to create an organization with name “Tools”. The error message says I am using a reserved name “Tools”. Never paid attention to the “reserved names” mentioned in the error message and unaware that we do have this restriction. A quick search pointed me to following blog post which has the query to findout the reserved organizations in MS CRM: 

Following is the list of Restricted Organizations:

1 About
2 Activities
3 AdvancedFind
4 api
5 AppWebServices
6 aspnet_client
7 bi
8 bin
9 Biz
10 Calendar
11 Condition
12 CRMReports
13 CS
14 dev
15 Help
16 Home
17 Import
18 MA
19 MSCRMServices
20 Notes
21 Products
22 rc
23 Reports
24 ReportServer
25 ResourceCenter
26 Sdk
27 SFA
28 signin
29 SM
30 support
31 Tools
32 tsweb
33 UnitTests
34 UserDefined
35 Workplace

Just thought of sharing…!!!! 🙂

How – To Series 12: Another restriction from Field Leve Security….!!!?

We all know that only OOB fields have been restricted from Field Level Security and all the custom fields can have Field Level Security. However, today i tried creating a new field of type “Single Line of Text” of format”EMail” with “Field Level Security” enabled.To my surprise I can see the following error:

And this is the error message in the Log file: “This field is not

I raised this issue with MSConnect here . Need to findout whether its bug or by design.

How-To Series 11: How To Trigger a plugin on Sharing a Record and Send An EMail

Hi All,
Today I have seen one forum post asking for Sending an email on Sharing a record. So, thought of implementing the same and blog it over here.
When a record is shared, a “PrincipalObjectAccess” record will be created in DB. However, we can’t register a plugin on “Create” Message for “PrincipalObjectAccess” entity. Instead, we can register it on “GrantAccess” message which will be triggered on sharing the record. So, simply register your plugin as follows:

Following is the piece of plugin code to get the details of record being shared and the users/team for whom the record has been shared. Here I am trying to send an email to the user for whom the record has been shared.

// The InputParameters collection contains all the data passed in the message request.if (context.InputParameters.Contains(“Target”) && context.InputParameters[“Target”] is EntityReference)

{// Entity Record which has been shared
EntityReference sharedRecord = ((EntityReference)context.InputParameters[“Target”]);
// System User for whom the record has been shared
EntityReference sysUser = ((PrincipalAccess)context.InputParameters[“PrincipalAccess”]).Principal;

// System User ID who has shared the record
Guid fromUserId = context.UserId;
// Send An EMail
SendEmail(service, sysUser, fromUserId, sharedRecord);

I have shared the entire plugin code over here: Here

PS: If we have shared the record to multiple users then this plugin will also be triggered multiple times. This means that, if you have shared a record to 5 users then an email will be sent to 5 users seperately not in a single shot.

Hope it helps…!!! 🙂