Sample code for ISV.CONFIG form button to pass the object id of record.


Just thought of putting this code over here, as i need it frequently 🙂

This one is for case entity.

 

<Entity name="incident">
          <ToolBar ValidForCreate="0" ValidForUpdate="1">
            <Button Icon="/_imgs/ico/16_convert.gif" Url="http://www.google.co.in" PassParams="1" WinParams="" WinMode="0" Client="Web">
              <Titles>
                <Title LCID="1033" Text="Url Button" />
              </Titles>
            </Button>
            <Button Icon="/_imgs/ico/16_convert.gif" JavaScript="window.open(‘http://www.google.co.in?oId=’+crmForm.ObjectId ,”,”);" PassParams="1" WinParams="" WinMode="0" Client="Web">
              <Titles>
                <Title LCID="1033" Text="JavaScript Button" />
              </Titles>
            </Button>
          </ToolBar>
        </Entity>

 

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…

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..

Cancel delete using PreDelete callout.


Just an example of using PreDelete callout !!!

public override PreCalloutReturnValue PreDelete(CalloutUserContext userContext,
   CalloutEntityContext entityContext,
   ref string errorMessage)
  {
   
   // Use retrive to get the status value
   CrmService service=new CrmService();
   service.CallerIdValue=new CallerId();
   service.CallerIdValue.CallerGuid=userContext.UserId;
   service.Credentials=System.Net.CredentialCache.DefaultCredentials;

   // Get status value
   ColumnSet cols=new ColumnSet();
   cols.Attributes=new String[]{“statuscode”};

   BusinessEntity busEntity= service.Retrieve(EntityName.salesorder.ToString(),entityContext.InstanceId,cols);

   salesorder poOrder=(salesorder)busEntity;
   // check for PO status value
   string poStatusValue=poOrder.statuscode.Value.ToString();

   // if status is found cancel the event and show error message
   if(poStatusValue==1)
   {
    errorMessage = “Aborting delete : Record cannot be deleted !”;
    return PreCalloutReturnValue.Abort;
   }
   
   return PreCalloutReturnValue.Continue;
  }

 Bye…