Friday 28 September 2012

Some of the CRM Blogs:


Ronald Lemmen - http://ronaldlemmen.blogspot.com/
Philip Richardson - http://blog.philiprichardson.org/
Gonzalo Ruiz - http://gonzaloruizcrm.blogspot.com/
Ross Lotharius - http://www.avanadeblog.com/xrm/
CRM Team Blog - http://blogs.msdn.com/crm/default.aspx
Andy Bybee - http://bybeeworld.spaces.live.com/
Ben Riga - http://blogs.msdn.com/benriga/default.aspx
Ben Vollmer - http://blogs.msdn.com/midatlanticcrm/default.aspx
Menno te Koppele - http://blogs.msdn.com/mscrmfreak/
Simon Hutson - http://blogs.msdn.com/ukcrm/default.aspx
Aaron Elder - http://www.avanadeblog.com/xrm/
Frank Lee - http://microsoft-crm.spaces.live.com/
Guy Riddle - http://guyriddle.spaces.live.com/
Matt Witteman - http://icu-mscrm.blogspot.com/
Michael Höhne - http://www.stunnware.com
Mitch Milam - http://blogs.infinite-x.net/
Scott Colson - http://msmvps.com/blogs/crm/default.aspx

 

A good link , which explains clearly silver light webresource developmet in mscrm 2011 using rest end point:

 
 

Code snippet for custom wcf service calling from mscrm 2011 form java script:




Call the Custom WCF request in Java Script:

Var xmlhttp = new XMLHttpRequest ();

Retrieve the WCF URL from from “ApplicationConfig” Entity using following method.

Var WcfServiceUrlValue= GetConfigValueByKey (Key Name);

WcfServiceUrlValue=WcfServiceUrlValue.avd_ConfigValue;

xmlhttp.open('POST', WcfServiceUrlValue , false);

//Get the request XML from WCF Test Client or Using Feddler Tool

//Place the Inteface name and Method Name following highlighted text.

xmlhttp.setRequestHeader('SOAPAction', 'http://tempuri.org/IDynamicsPaymentService/UpdateExpiredCheque ');

xmlhttp.setRequestHeader('Content-Type', 'text/xml');

var data = '';

data+='<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">';

data+='<s:Body>';

   data+='UpdateExpiredCheque  xmlns="http://tempuri.org/">';

   data+='<data xmlns:d4p1="http://schemas.datacontract.org/2004/07/ UU.Crm.WCFService.DataContracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">';

       data+='<d4p1:CaseNumber>12345</d4p1:CaseNumber>';

        data+='<d4p1:ChequeAmount>200</d4p1:ChequeAmount>';

        data+='<d4p1:ChequeNumber>23421213</d4p1:ChequeNumber>';

        data+='<d4p1:OriginalPaymentDate>1/10/2012</d4p1:OriginalPaymentDate>';

        data+='<d4p1:OriginalPaymentReference>1234</d4p1:OriginalPaymentReference>';

      data+='</data>';

    data+='</UpdateExpiredCheque>';

  data+='</s:Body>';

  data += '</s:Envelope>';

            xmlhttp.send(data);

            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");

            xmlDoc.async = false;

            xmlDoc.loadXML(xmlhttp.responseXML.xml);

//Check the Response Object  and Retrieve the tag values following way.

if (xmlDoc.xml != "") {

                var Msg;

                var ResponseCollection = xmlDoc.getElementsByTagName("a:ResponseCollection");

                if (ResponseCollection.length > 0) {

                    if (ResponseCollection[0].firstChild != null) {

                        Msg = "Message Severity :" + ResponseCollection[0].firstChild.childNodes[0].nodeTypedValue + '\n';

                        Msg += "Warning :" + ResponseCollection[0].firstChild.childNodes[1].nodeTypedValue;

                        alert(Msg);

                    }

                }

            }

Friday 21 September 2012

Sample code to modify the users  last viewed form id :


CRM saves the Id of the last form that a user viewed using the UserEntityUISettings entity, and any UserEntityUISettings record can be easily updated to set the Last Viewed form for a specific user:

//retrieve the user UI settings for a specific user and a specified entity:
QueryExpression query = new QueryExpression(UserEntityUISettings.EntityLogicalName);
query.Criteria.AddCondition("ownerid", ConditionOperator.Equal, userId);
query.Criteria.AddCondition("objecttypecode", ConditionOperator.Equal, entityObjectTypeCode);
EntityCollection UISettingsCollection = service.RetrieveMultiple(query);
if (UISettingsCollection.Entities.Count > 0)
{
//update the last viewed formId:
UserEntityUISettings settings = (UserEntityUISettings)UISettingsCollection[0];
settings.LastViewedFormXml = "<MRUForm><Form Type=\"Main\" Id=\"f5cfab6a-d4c2-4519-b68f-6e7485432e29\" /></MRUForm>";
service.Update(settings);
}

ODATA  restrictions in mscrm 2011:

 

Operator

Restrictions

$expand
· Max expansion 6
$top
· Page size is fixed to max 50 records
· $top gives the total records returned across multiple pages
$skip
· When using with distinct queries, we are limited to the total (skip + top) record size = 5000.
· In CRM the distinct queries does not use paging cookie are and so we are limited by the CRM platform limitation to the 5000 record.
$select
· One level of navigation property selection is allowed I.e.
…/AccountSet?$select=Name,PrimaryContactId,account_primary_contact
…/AccountSet?$select=Name,PrimaryContactId,account_primary_
contact/LastName&$expand=account_primary_contact
$filter
· Conditions on only one group of attributes are allowed. By a group of attribute I am referring to a set of conditions joined by And/Or clause.
· The attribute group may be on the root entity
.../TaskSet?$expand=Contact_Tasks&$filter=Subject eq 'test' and Subject ne null
· (or) on the expanded entity.
.../TaskSet?$expand=Contact_Tasks&$filter=Contact_Tasks/FirstName eq '123‘
· Arithmetic, datetime and math operators are not supported
· Under string function we support Substringof, endswith, startswith
$orderby
· Order are only allowed on the root entity.
Navigation
· Only one level of navigation is allowed in any direction of a relationship. The relationship could be 1:N, N:1, N:N