السبت، 1 فبراير 2014

CRM 2011:The specified record type does not exist in microsoft dynamics crm

It appears your sitemp has reference to entity not found.
"contains reference to entity new_tribute but that entity was not found in the metadata cache"
go to SiteMap then delete this entities and update sitemap then it will work.

الأربعاء، 29 يناير 2014

CRM 2011 : unable to cast object of type 'microsoft.xrm.sdk.entity' to type 'xrm.account'

To Solve it

Use enableProxyTypes method on your Organization Service proxy to fix it, here is the sample for generating organization service proxy properly:

OrganizationServiceProxy orgService = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
 orgService.EnableProxyTypes();

 orgService.Authenticate(); 
 IOrganizationService _service = (IOrganizationService)orgService;

How to use linq with crm 2011 plugin


create XrmServiceContext class
  a- run command prompt 
  b-write the following command "cd C:\Program Files\Microsoft Dynamics CRM\tools" then press enter
  c- write the following command then press enter
        CrmSvcUtil.exe /out:Xrm.cs /url:http://serverName/OrgName/XRMServices/2011/Organization.svc /domain:domainName /username:YourUserName /password:yourPassword /namespace:Xrm /serviceContextName:XrmServiceContext

       (Note:replace the red words with your CRM login configuration)
  d- go to the following path "C:\Program Files\Microsoft Dynamics CRM\tools" and copy "Xrm.cs" file then past to your project.

using (var crm = new XrmServiceContext(service))
 {
       var QuoteProduct = crm.QuoteDetailSet.Where(c => c.QuoteDetailId == QPID).First();
       foreach((var item in QuoteProduct)
      {

      }
}



الأحد، 26 يناير 2014

CRM 2011: Set the focus to control

function ControlSetFocus(fieldName) {
    var attribute = Xrm.Page.data.entity.attributes.get(fieldName);
    var control = attribute.controls.get(0);
    control.setFocus(true);
}

CRM 2011 Validate required form using javascript


This code checks if form is valid for saving, by going over all required attributes and checking if it contains value.

function IsFormValidForSaving(){
var valid = true; Xrm.Page.data.entity.attributes.forEach(function (attribute, index) { if (attribute.getRequiredLevel() == "required") { if (attribute.getValue() == null) { if (valid) { var control = attribute.controls.get(0); alert(control.getLabel() + " Field is empty"); control.setFocus(); } valid = false; } } }); return valid;
}
http://dynamicslollipops.blogspot.com/2012/07/microsoft-dynamics-crm-2011-validate.html