XMLHTTPRequest will fail if internet connection uses proxy server.

The XMLHTTPRequest will fail if you have proxy configured. we need use WinHttp instead of it. Refer the code pasted below.

if(sProxyIPAddress.Length != 0)
{
WinHttp.WinHttpRequest xmlhttp = new WinHttp.WinHttpRequest();
//Accessing the web service using Get method
xmlhttp.Open("GET", "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + sfromCurrencyCode + "&ToCurrency=" + sBaseCurrency , null);
xmlhttp.SetProxy(2,sProxyIPAddress, null);
xmlhttp.Send(null);
xmlresult.loadXML(xmlhttp.ResponseText);
}
else
{
//Accessing the web service using Get method
MSXML2.XMLHTTP30Class xmlhttp = new MSXML2.XMLHTTP30Class();
xmlhttp.open("GET", "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + sfromCurrencyCode + "&ToCurrency=" + sBaseCurrency, false, null, null);
xmlhttp.send(null);
xmlresult.loadXML(xmlhttp.responseText);
}

How to call parent windows functions in Java Scripts

The following code will help you to call the parent windows javascript methods. It will work if the window is not closed.

window.opener.parent.CommonConvertPreferredCurrency()

Eg:

if(!window.opener.closed) {
if(window.opener.parent.CommonConvertPreferredCurrency) { window.opener.parent.CommonConvertPreferredCurrency(); } }

Global Javascript function for MS CRM Entities

Normally it is not possible to write Global/Common Javascript methods for CRM entities, becuase it allowing to write inside the event scripts.

To obtain this write the javascript function inside the entity event handler and assign to a global variable. Then the variable will be act as function.

To declare a variable as global just declare without "var" in statements.

Eg:

CommonConvertPreferredCurrency = ConvertPreferredCurrency;

function ConvertCurrencySymbol(currencySymbol){
// to do
}

The global functions can be called in same form anywhere in same form. However it will not work as .js files

Javascript will fail/ throw error if last line is commented

CRM Javascript will stop running or throw error if the last line of code(Exact last line) is commneted.

This is becuase CRM Entity Edit form saves the script by adding closing backet to end of the script without adding carrige return before to it. So that the added closing bracket will come as commented.

OnChange event of MS CRM lookup control

The OnChange of the MS CRM Lookup control will not fire, if previously any lookup attribute has been filled by selecting the value from the Form Assistant.

A solution for this isuue is to call FireOnChange in OnSave by checking it.


I have found this problem only for the LookUp Controls

Outlook appointment non- invitee attendies will not be saved in CRM

The appointment which have non-inviting attendies, the name will not be saved in the MS CRM Appointments. After the synchrnisation happens between MS CRM outlook, the non-invities will be erased.

To overcome this I suggest to wite a windows service which fetch the list of Exchange server appointment attanedies and saves in MS CRM appointment invitees. This has to happen in intervals less than MS CRM synchronisation intervals.

The defect of the above approach is the disability to save as non-invitee itself.