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.


Thursday, January 27, 2011

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


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.value = '';

Hope it will help many more.


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");"GET", scriptFile, false);

//call the above function by passing your file name(absolute path)
//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

Have a wonderful coding.