Google Anlatics

Thursday, June 27, 2013

CRM 2011 with JavaScripts

How to show/hide filed
Xrm.Page.ui.controls.get("city").setVisible(true/false);
How to clear filed
Xrm.Page.getAttribute("city").setValue(null);
How to enable/disable
Xrm.Page.ui.controls.get("city").setDisabled(true/false);
Modify Field Label Tooltip 
document.getElementById("field_name_c").setAttribute("title","tooltip text");
Modify Lookup Button Tooltip 
document.getElementById("field_name").setAttribute("title","tooltip text”);
Set required Filed
function SetRequirementLevelNon(fieldName) { var type = Xrm.Page.data.entity.attributes.get(fieldName); type.setRequiredLevel("none"); } function SetRequirementLevel(fieldName) { var type = Xrm.Page.data.entity.attributes.get(fieldName); type.setRequiredLevel("required"); }

Find the CRM field Name

I have found this way get the name of field name without going to open the CRM form.
Open one of the record of the entity and go to developer tool bar. This facility is available for all the Brower’s.

Below screen shot for look-up field and using this method we can easily find the name of the field

Wednesday, June 19, 2013

How to fix a CRM 2011 Update Rollup 12 JavaScript issues

Below link has all the information about CRM 2011 Update Rollup 12


First thing is to do is

Enable HTC behavior files in CRM 2011 UR12/Polaris/December 2012 Update

1.     Open the Dynamics CRM Web UI, Click Settings, in the left navigation click Administration, in the main area of the UI click on System Settings to launch the system settings dialog box
2.     In System Settings dialog box click the Customization Tab, and under HTML Component Support check the box for “Include HTC Support in Microsoft Dynamics CRM Forms















Microsoft Dynamics CRM 2011 Custom Code Validation Tool

Consider familiarizing yourselves with this tool… though the download page mentions Update Rollup 9, it hasn’t had much utility until now since the UR9 changes mentioned in the summary below were never released until UR12:


Use the Microsoft Dynamics CRM 2011 Custom Code Validation Tool to identify potential issues with custom JavaScript in JavaScript libraries and HTML web resources. The Microsoft Dynamics CRM Online Q2 2012 Service Update and Microsoft Dynamics CRM 2011 Update Rollup 9 include significant changes in the web application in order to be able to support a variety of browsers such as Safari, Chrome, and Firefox. When using JavaScript code in Dynamics CRM, it is possible that some code will stop working or cause an error when you upgrade. The Microsoft Dynamics CRM 2011 Custom Code Validation Tool helps identify potential problems so that a developer can fix them.

Microsoft Dynamics CRM 2011 Custom Code Validation Tool Setup

  1. Launch Microsoft Dynamics CRM using Internet Explorer with a user account that has privileges to import solutions.
  2. Log into the Microsoft Dynamics CRM organization that you want to install the solution.
  3. Click the Settings area in the left hand navigation pane in Microsoft Dynamics CRM 2011.
  4. Click the Solutions navigation item under the Customizations sub-area in the left hand navigation pane.
  5. Click the Import button on the toolbar for the All Solutions grid view.
  6. Click the Browse button and select the folder where the CustomCodeValidationToolForMicrosoftDynamicsCRM201_1_0_0_0_managed.zip file is located.
  7. Click the Next button and proceed to import the solution.
  8. Once the import completes, click the Close button to close the Import Solution dialog.
  9. Click the Publish All Customizations toolbar button on the All Solutions grid view to publish the solution.
  10. To launch the tool, double click on the CustomCodeValidationTool solution to open it.
  11. Click the Open the Custom Code Validation Tool button on the solution’s Configuration Page to launch the tool.
Some of the screen shot of the Custom Code Validation Tool












 


These are some fixes I have done.

Earlier version

With Roll-up 12


var xmlHttpRequest = new
ActiveXObject("Msxml2.XMLHTTP");


var xmlHttpRequest = new XMLHttpRequest();


event.returnValue = false;


context.getEventArgs().preventDefault();

IsDirty();

Xrm.Page.data.entity.gsetIsDirty();



crmForm.FormType


Xrm.Page.ui.getFormType()


crmForm.ObjectTypeName


Xrm.Page.data.entity.getEntityName()


The XMLHttpRequest is being created using ActiveX, which is only supported by Internet Explorer.
Simply changing the affected code to the below has fixed the issue and it now works across all browsers.

var xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("POST", "/mscrmservices/2007/CrmService.asmx", false);

Note: The change on the second line may not be obvious, but .open has been changed to use a lower case O
This is for Cross Browser Remove these two lines: There is no issue with IE

xmlHttp.setRequestHeader("Content-length", params.length);

xmlHttp.setRequestHeader("Connection", "close");

XMLHttpRequest isn't allowed to set these headers, they are being set automatically by the browser. The reason is that by manipulating these headers you might be able to trick the server into accepting a second request through the same connection, one that wouldn't go through the usual security checks - that would be a security vulnerability in the browser.

subgrid.control


subgrid.control.setParameter("fetchXml", fetchXml); is changed to 
subgrid.control.SetParameter("fetchXml", fetchXml);


same like

subgrid.control.refresh(); to
subgrid.control.Refresh();

All function of subgrid.control will start with capital character

As the name suggests this DOM function is used to access an element of the page and it is used very often by most web developers. However, because the Xrm.Page object model provides the supported way to access form elements, any use of the getElementById function should be examined carefully.
It is fine to use getElementById to access elements in HTML web resources. But if this method is used to access Microsoft CRM application elements, there is no guarantee that the Id attribute value will be the same. When it changes, code that depends on this method to access the Microsoft CRM application elements will be broken. The way to avoid this is to use the Xrm.Page API.

Tuesday, June 11, 2013

Microsoft Dynamics CRM 2011 Shortcuts

1. General Shortcuts
Ctrl+Shift+5 Minimize ribbon
Ctrl+x, Ctrl+c, Ctrl+v Cut, Copy, and Paste
Ctrl+z/Ctrl+y Undo / Redo previous text change
Ctrl+s Save a record
Esc Close a record
Delete Delete text
Shift+Delete Delete selected text immediately without putting it on the Clipboard
Ctrl+[/Ctrl+] Move to the first tab / last tab on the ribbon
Ctrl+Arrow Right/Ctrl+Arrow Left Move the insertion point to the start of the next word / start of the previous word
Ctrl+a Select all text in the current field
Alt+Space Display the System menu for the active window
Shift+F10 Display the shortcut menu for the selected item
Esc Cancel the current task or command, or close a selected list or dialog box
Arrow Up/Arrow Down Move up / move down through a list of records
Enter Open the selected record
Ctrl+a Select all records on the current page
Ctrl+Shift+3 Jump to the sitemap
Ctrl+Shift+7 Open the recently viewed pages and view menu
Shift+Arrow Up/Shift+Arrow Down Select multiple rows in a list sequentially
Tab to the check box, then Spacebar Select multiple rows in a list non-sequentially
Ctrl+Enter Publish Form Editor customization


2.Dialog Box Shortcut
Tab/Shift+Tab Move to the next / move to previous option or option group
Enter Complete the command for the active option or button
Arrow Keys Move between options in an open list, or between options in a group of options
Esc Cancel a command, or close a selected list or dialog box



3. Forms
Ctrl+s/Shift+F12 Save
Alt+s Save and close
Esc Cancel edits and close (Close)
Space/Enter Open search
Backspace Delete text from search field
Ctrl+d Delete the record
Ctrl+Shift+s Save and then open a new form (Save and New)
Tab/Shift+Tab Move forward / backwards through the form's fields
Alt+Arrow Down Open the lookup menu with the most recently used items in alphabetical order
Ctrl+Shift+2 Open the list menu
Ctrl+>/Ctrl+< Navigate to the next / previous item on the list
Sri Lanka .NET 
                Forum Member