Wednesday, February 16, 2011

Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message:

if u will get error message like this while in plugin or else using the sdk for any external application.
make sure the crmserver url is correct.
some times we used to forget to add the port number if its thr.

yes.sudhanshu

Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message:

if u will get error message like this while in plugin or else using the sdk for any external application.
make sure the crmserver url is correct.
some times we used to forget to add the port number if its thr.

yes.sudhanshu

Invalid Action, the selected action was not valid error in ms crm 4.0

If such kind of error Invalid Action, the selected action was not valid in ms crm 4.0 while loggin in or else already logged in and trying to acces any record or doing some action,
then just try to make the MSCRMAsynchronous Service up.
Even if its showing started in the services, just restart it.

This is a way i hv solved.

yes.sudhanshu

Wednesday, February 9, 2011

refreshing continuously the textbox(textarea) in dot net

some times we need to show the status to the user if some log process is going on. also if any exception in that process.
for that if we will write the message to a textbox(textarea), it will look like realtime message as follow.

the textbox(textarea) control name is "txtStatus"
//each time append the new text to the previous text
txtStatus.Text += "Message from the businees logic to be displayed.";
// this main to just update the control , so that the new text will refreshed
txtStatus.Update();

yes.sudhanshu

Getting project current path in dot net

just use this to get the project current path.
soem times we need to create the log folder inside the project path with bin and other folders.
this is in windows application.

string path = Directory.GetParent(Path.GetDirectoryName(Application.StartupPath)).FullName;

yes.sudhanshu

Sunday, January 30, 2011

Organise the NameSpaces in visual studio

Sometimes we used some namespaces and we delete the references. still the using statement will be there. to make it clean we can use a shortcut, which wecan configure as follows.

go to Tools -> Options from visual studio.
Select Keyboard from left items.
then select "Edit.RemoveAndSort"
Now ether the key strokes you like in press Shortcut key text box (suppose ctrl+shift+w).Keep in mind all the three you have to press @ one short.

yes.sudhanshu

Thursday, January 27, 2011

Default look up value with out knowing the GUID only the text in MS CRM 4.0

Hi,

The default lookup can be done clearly and in supported way as in sdk in my othe r link. Default lookup value with GUID.

Some times while working in dev,UAT and prodution and moving from here to there
or if any one deleted the record and recreated again , means in any chance the GUID got changed , then it will not work.
But one thing here is , only one record should be there in the same name.
Even if its unsupported, still very usefull.

document.all.<FieldScemaName>_ledit.value = 'Default Lookup Value';
document.all.<FieldScemaName>_ledit.fireEvent("onblur");
document.all.<FieldScemaName>_ledit.value = '';

Hope it will help many more.

yes.sudhanshu

Thursday, January 20, 2011

Enable Tracing Ms Crm 4.0

Some times we nned to enable the tracing in ms crm server to get the error details.
But do not forget to disable it again after getting the error details , as it will slow down the process.
for the same just follow the link

Enable Tracing

saving another entity form from one form

Suppose we want to put an entity record in another entity form and on change of anything in the parent we also want to put the value in the child record and also want to save that. This can be done :)

var iframe = crmForm.all.IFRAME_CustomEntity
var iDoc = iframe.contentWindow.document;
var iframe_isSaved = true;

// checking if the Custom Entity has been changed
if (iDoc.crmForm.IsDirty())
{
// save Custom Entity
var iframe_isSaved = iDoc.crmForm.Save();
}

if (iframe_isSaved == false) // validation failed on Custom entity
{
event.returnValue = false; // Cancel the SAVE on Account
return false;
}

Just test and see.

Monday, January 10, 2011

How to Load external JS files in MS CRM Form

Some times its really helpful to link the external js files to a form.
It will help you, that you can srite in a file by using VS studio or any js editor.

//create the function which will load the file
function LoadExternalScript(scriptFile)
{
var netRequest = new ActiveXObject("Msxml2.XMLHTTP");
netRequest.open("GET", scriptFile, false);
netRequest.send(null);
eval(netRequest.responseText);
}

//call the above function by passing your file name(absolute path)
LoadExternalScript("/ISV/js/filename.js");
//now call the OnLoad function, which has defined in the external JS file
//also you can define and call other function, in the external JS files
OnLoad();

Have a wonderful coding.

Sudhanshu