Disable parent form fields from related entities form


We had a requirement like when a opportunity record is created from within an account form, the fields in the account form should get disabled.

This is the JavaScript that could be used for doing so, it is on the onSave event of the Opportunity form.

 

if (
(window.opener != null) &&
(window.opener.parent != null) &&
(window.opener.parent.document != null) &&
(window.opener.parent.document.crmForm != null)) {

var parentForm = window.opener.parent.document.crmForm;

if (parentForm.ObjectTypeName == "account")
{

// disabling field individually
parentForm.name.disabled=true;

// loop through all the fields and disable them

for(i=0; i<parentForm.elements.length; i++)
      {
            parentForm.elements[i].disabled=true;
      }

// lookups need to be disabled separately
parentForm.parentaccountid.disabled=true;

}

}

 

Bye…

No Organization to select while configuring Microsoft Outlook client for CRM


I was trying to configure outlook client for CRM, after entering my url for the CRM server, the next screen, where we could select organization wasn’t displaying any organization.

I followed the steps mentioned in the following post and then i tried again and this time it was showing the name of the organizations there.

https://nishantrana.wordpress.com/2008/11/06/the-request-failed-with-http-status-401-unauthorized-mandatory-updates-for-microsoft-dynamics-crm-could-not-be-applied-successfully/

Bye..

Refresh Parent Form from child entity in CRM.


Check out this wonderful article by Andriy (the master in CRM) on it.

http://a33ik.blogspot.com/2009/05/page-refresh.html

And the same code translated for CRM 3.0.

function timerHandler()
{
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
"  <soap:Body>" +
"    <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\" xmlns=\"http://schemas.microsoft.com/crm/2006/WebServices\">" +
"      <q1:EntityName>salesorder</q1:EntityName>" +
"      <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
"        <q1:Attributes>" +
"          <q1:Attribute>modifiedon</q1:Attribute>" +
"        </q1:Attributes>" +
"      </q1:ColumnSet>" +
"      <q1:Distinct>false</q1:Distinct>" +
"      <q1:Criteria>" +
"        <q1:FilterOperator>And</q1:FilterOperator>" +
"        <q1:Conditions>" +
"          <q1:Condition>" +
"            <q1:AttributeName>salesorderid</q1:AttributeName>" +
"            <q1:Operator>Equal</q1:Operator>" +
"            <q1:Values>" +
"              <q1:Value xmlns:q2=\"http://microsoft.com/wsdl/types/\" xsi:type=\"q2:guid\">"+crmForm.ObjectId+"</q1:Value>" +
"            </q1:Values>" +
"          </q1:Condition>" +
"        </q1:Conditions>" +
"      </q1:Criteria>" +
"    </query>" +
"  </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple&quot;);
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
var source = resultXml.selectSingleNode("//modifiedon").nodeTypedValue;
alert(source);
var firstpart = source.split(‘T’)[0];
var secondpart = source.split(‘T’)[1].split(‘+’)[0];
var parts =  firstpart .split(‘-‘);
var parts2 = secondpart.split(‘:’)
var modifiedon = new Date();
modifiedon.setYear(parts[0]);
modifiedon.setMonth(parts[1] – 1);
modifiedon.setDate(parts[2]);
modifiedon.setHours(parts2[0]);
modifiedon.setMinutes(parts2[1]);
modifiedon.setSeconds(parts2[2]);
if (modifiedon > openDate)
location.reload();
}
var openDate = new Date();
if (crmForm.FormType == 2)
setInterval(timerHandler, 1000);

 

Bye…

Understanding pipeline in CRM 4.0


Different stages in the event execution pipeline introduced in CRM 4.0.

Stage #1

•Pre-Operation – This is where custom logic can be registered to execute before the platform operation occurs. Logic that runs in this stage can stop further execution of the pipeline as we will discuss more in the plug-in chapters. Custom logic that runs in this stage is not part of the platform transaction.

Stage #2
•Pre-Operation – System – This stage is reserved as a pre-operation stage for system internal processing. Operations that occur as part of this stage are part of the Platform Transaction.You can’t register your own custom logic to run during this stage.

Stage #3
•Platform Operation – This is where the real work happens. The request/event that caused us to be in the pipeline is processed here and reflected on the state of the system. This stage is also part of the Platform Transaction. You can’t register your own custom logic to run during this stage.

Stage #4
•Post-Operation-System -This stage is also reserved as a post-operation stage for system internal processing. Operations that occur as part of this stage are part of the Platform Transaction. You can’t register your own custom logic to run during this stage.

Stage #5

•Post-Operation -This is where custom logic can be registered to execute. Custom logic in this stage can be either synchronous or asynchronous. Asynchronous logic will be handed off for processing by the Asynchronous Service queue. Custom logic that runs in this stage is not part of the platform transaction.

For better understanding of pipeline check out this wonderful article

http://crmscape.blogspot.com/2009/02/ms-crm-40-plug-in-stages-pipelines-and.html

Bye..

0x80044150 Generic SQL error. Platform : Server was unable to process the request in CRM


Hi,

I got this error while using CrmService from an web application.

Later i found that Crm Asynchronous Service(client)  was not running, so starting it solved the issue.

Just thought of sharing that !

Bye..

Hiding form assistant in CRM


Hi,

We could use the following script to hide the form assistant in Crm , we would use it in the form load event

document.getElementById(‘RelatedInformationPane’).style.display=’none’;

// ToggleInformationPane() to toggle the form assistant pane

document.all.RelatedInformationPane.ToggleInformationPane();

For CRM 4.0, go to customization ->customize entities-> select your entity–> select form properties->select Display tab and uncheck enable form assistant check box !!

Bye..