Archive

Posts Tagged ‘Rajeev Pentyala’

Submit disabled field using Jscript in CRM 2011

Hi,

Below is the syntax to submit the disabled field value using JScript.

Xrm.Page.getAttribute(“{fld_id}”).setValue(“{fld_value}”);

Xrm.Page.getAttribute(“{fld_id}”).setSubmitMode(“always”)

Hope it helps 🙂

Handling Tab click event in CRM 2011

Hi,

We can fire our own Jscript function on CRM tab click. Below are the steps

 How to get ID of Crm Form Tab :-

  • Get the ID of the ‘Tab’, using IE browser Developer Tool (i.e., Click F12)  (See image above)

Code :-

  • Attach “onclick” event handler on page ‘OnLoad’ method

function Form_onload() {
//Attach ‘onclick’ event handler to “Tab”
var linkGeneral = document.getElementById(“tab0Tab”);   //’tab0Tab’ is the ID of ‘General tab’
if (linkGeneral) {
linkGeneral.attachEvent(“onclick”, tab_onclick);

}

}

Function tab_onclick(){

//This function fires on Tab Click;

//Write your code

}

Hope it helps 🙂

[Async_ExceptionOccurred] error with “CRM 2011 OData Query Designer”

ODataQueryDesinger_Async Issue
Hi,

   When you try to run “CRM 2011 OData Query Designer” tool, you may come up with the “Asynchronous Error” as above.

Reason: –

  • This is the Silver light Cross – Domain issue (Since, OData Query Designer built using Silver Light)
Fix: –
  • Instead of using “http://localhost/org_name/main.aspx” to browse the CRM application,
  • Browse with “Computer Name” i.e., “http://computername/org_name/main.aspx”
Hope it Helps 🙂

Machine hangs up when you put a ‘debugger;’ in jScript “OnChange” event

July 28, 2011 1 comment

Hi,

While debugging a Jscript file ,Sometimes you may come across the situation where your machine gets hanged and it won’t even allow you start ‘Task Manager’ to kill the process.

 It happens, if you have the similar scenario

  • If you put a ‘debugger;’ command in ‘onChange’ event of Dropdown
  • If this is the only ‘debugger;’ command you put on the entire Jscript file
  • Enable script debugging in browser
  • Raise the ‘onChange’ event by changing dropdown value in the CRM Form

Workaround:-

  • Always make sure to have one more ‘debugger;’ that called before hitting
    the ‘debugger;’ in ‘onChange’ event
  • Preferably always put a ‘debugger;’ in page ‘onLoad’ event when you
    want to debug the ‘onChange;’ event

Hope it helps 🙂