CRM Crate

Understanding the String (RESX) web resources in Dynamics 365

We will learn & understand the use of String (RESX) web resources in Dynamics 365. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Dynamics 365.

Understanding the String (RESX) web resources in Dynamics 365

What are RESX files?

The .Net Resource (.resx) files are a monolingual file format used in Microsoft .Net Applications. The RESX or Resource Files are used by programs developed with Microsoft’s .NET Framework, itstores objects and strings for a program in an XML format. RESX file may contain both plain text information as well as binary data, which is encoded as text within the XML tags.

How to create a RESX file?

We will create a Resource File with an extension “.resx” using the Visual Studio IDE. Follow the below given steps to create a RESX File.

Step 1 – Open the Visual Studio IDE.

Step 2 – Create a new Resource File as shown below.

Step 3 – Create your own Key Value pair in the RESC file.

Note: – In our case, we have created a key value pair for describing the language translation where the key describes the English language word and the value describes its Marathi language equivalent word as shown below.

Step 4 – Save the RESX file in your local system.

Using RESX file in Dynamics 365

We will retrieve & use the above created RESX file in Dynamics 365 with help of client side scribe and Microsoft web APIs.

Client API for accessing RESX file

We will use the getResourceString client API for consuming the RESX file data.


Returns the localized string for a given key associated with the specified web resource.

Use Case for demonstration –

  • For demonstration purpose, we will use the RESX file for achieving the English language to Marathi language text translation in Dynamics 365.
  • The user will enter a English text as an input in Dynamics 365 form’s field and its Marathi language equivalent text will populate automatically in another field using the client side scripting.

Creating a RESX web resource in Dynamics 365

Follow the below steps to configure & create the RESX web resource in Dynamics 365.

Step 1 – Open the Power Apps solution explorer & navigate to the customizations as shown below.

Step 2 – Create a new RESX web resource with the below given properties.

  • Resource Name – Make sure to add language code (English : 1033) and “.resx” extension in the resource name. In our case we will use English (United States) language in the RESX resource. Therefore, our resource name would be “CRMCrateRESX_1033.resx”.
  • Type – Select “String (RESX)” as web resource type.
  • Language – Select an appropriate language of your choice (Ensure to update the language ID in the web resource name).
  • Upload File – Upload the previously created .Net RESX file in the web resource.

Step 3 – Save & publish this newly created RESX web resource.

Creating a JavaScript web resource in Dynamics 365

We will now create a JavaScript function to use & consume the above created RESX web resource with help of getResourceString client API.

Note: – The below JavaScript function has been triggered during the “OnChange” event of form’s field.

Refer the below code and create a new JavaScript web resource in Dynamics 365.

//CRM Crate - JavaScript Snippet
function CallMethod (executionContext) {

//Reading Attribute Value From The Form.
var formContext = executionContext.getFormContext();

//Reading Value From Input Field.
var InputFieldValue = formContext.getAttribute("cc_inputengishtext").getValue();
if(InputFieldValue != null || InputFieldValue != undefined)

//Consuming RESX Web Resource & Storing The Return Value In A Variable.
var OutputText = Xrm.Utility.getResourceString("cc_CRMCrateRESX", InputFieldValue);

//Setting Value In Form's Field.

Validate the changes in Dynamics 365

Once the RESX and JavaScript web resources are configured and deployed, navigate to the Dynamics 365 record and validate the changes as shown below.

Thus, we learned the String (RESX) web resources in Dynamics 365.

5 2 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
error: CRM Crate Security Engine - Disabled Right Click & Selection!


Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.