Ribbon debug/Command checker tool

Image
Background: Usually when something goes wrong in the button visibility or to find out the rules, actions(js) being used in the ribbon button, we go and find either in the ribbondiffxml or through ribbon workbench. This is a time taking process.  Solution: Now there is a built-in tool called 'Command Checker' available. Using this tool, we can easily troubleshoot the button visibility related issues in home page grid, entity form, sub grid and global command bar as well.  To use/enable this tool, pass "ribbondebug=true" parameter in the url. Example, if you want to troubleshoot some button in Account form, below is the url,  https://trial.crm5.dynamics.com/main.aspx?appid=4db5bcb8-675b-ec11-8f8f-002248599a15&pagetype=entityrecord&etn=account&id=83883308-7ad5-ea11-a813-000d3a33f3b4 &ribbondebug=true This will enable the command bar in 3 places. 1. In the header's right side 2. In the Form command bar 3. If the form has any sub grids. Co...

Using Resx file in D365 JS

Most of the times, we have validation or error messages to be shown to user during client side validations in D365. We directly hardcode these message in the JS functions. Instead we can use Resources file(.resx) to store all the messages in common file and use it wherever it is required.  This helps in maintaining the code and also promotes reusability. 

This file format is also supported in web resources.

Creation of Resource file:

In visual studio, resource file can be directly created as shown below.








Add the validations message as shown below and save the file(eg:UserValidationMessages). You can add as many messages you want.

Open D365 web resource and upload this file by selecting Type as 'String(RESX)' as shown below.


Below is the sample code to retrieve the messages from resource file.
  var emailValidationMessage = Xrm.Utility.getResourceString("new_UserValidationMessages.resx", "AccountEmailAddressValidationMessage");  



The resource file can be updated anytime by downloading the file from webresource url as shown below.


Save the file. 

Open in Visual studio and update the message.

This file can be updated back to web resource as shown below.


This approach can also be used in multi-language supported applications where message should be shown based on the user selected language.

Comments

Popular posts from this blog

Convert datetime to user local in D365 Plugins

Show/Hide ribbon button based on the selected view in the D365 subgrid

Ribbon debug/Command checker tool