Introduction:
As we all know the new release of Dynamics 365 i.e v9.0 has come up with many new features. Along with these features Microsoft also introduced below new web resources for Dynamics CRM.
- Vector Format (SVG)
- String (RESX)
In this blog, we are going to check how to work with web resource type “String (RESX)”. The main purpose of this web resource type is to support language-specific translation. Where developers can skip traditional way of doing translation by maintaining translation in JavaScript JSON or by maintaining separate entities for translation and others. And language specific resource makes it easy to maintain.
Below are the steps to use web resource
1. Create RESX web resource :
To create RESX web resource, Developers needs to create RESX file first. There are two ways for it.
a. First, Add “Resource File” in your Visual Studio project as below,
Then update data in same as shown in the below screenshot.
b. Secondly, you can create XML with below syntax and rename the file extension to RESX.
Once you created a file, create webresource in CRM for the same. Make sure to select the language for the resource this makes it language specific. If you don’t specify the language it will be accessible in other languages as well. We can use this feature for translation of default language, in case there is no language specific translation available.
Note: Creating WebResource for default language doesn’t assure default language translation. CRM does the task of verifying login user language and web resource language.
2. Add Dependent resource:
Next we need to add “RESX” web resource in dependencies tab of JavaScript web resource as shown in the below screenshot.
3. Call resource from your JavaScript :
You need to retrieve values from “RESX” web resource using below function.
Here the first parameter is the name of the CRM Webresource and the second parameter is Name of from the RESX file as shown in the below screenshot.
We have displayed same in a onload script and below result we get.
Conclusion:
RESX web resource helps the user in language specific translation. Using this, developers can skip traditional way of doing translation and do it easily using simple steps above.