Posts

Showing posts from April, 2012

Dynamic Filtered Views in CRM2011

If you want to create a dynamic filterd lookup in crm2011 Ex:- If you have a account lookup & a contact lookup in a form & you want to filter & view the only contacts who's parentcustomer is equal to the selected account. You can use the following var defaultViewId; // FUNCTION: formOnLoad function formOnLoad() { var lookupFieldName = 'new_contactid'; var accountFieldName = 'new_accountid'; defaultViewId = Xrm.Page.getControl(accountFieldName).getDefaultView(); setLookup(accountFieldName, lookupFieldName, false); } // FUNCTION: setLookup function setLookup(accountFieldName, lookupFieldName, resetSelection) { // Get the selected Account Id in the [accountFieldName] indicated control var account = Xrm.Page.getAttribute(accountFieldName).getValue(); if (account != null) { var accountid = account[0].id; var accountname = account[0].name; if (resetSelection == true) { // ...

Object type DataMembers in WCF DataContract

When we want to create a datacontract with a DataMember of the type 'object' then we have to add the KnownType Attribute for that DataContract so that the serializer will know the types allowed for that generic type. [KnownType(typeof(string))] [KnownType(typeof(int))] [KnownType(typeof(decimal))] [KnownType(typeof(float))] [KnownType(typeof(double))] [KnownType(typeof(bool))] [KnownType(typeof(char))] [KnownType(typeof(DateTime))] [KnownType(typeof(Guid))] public class RMEntity { public ConcurrentDictionary attributes = new ConcurrentDictionary (); [DataMember] public ConcurrentDictionary Attributes { get { return attributes; } set { attributes = value; } } }

Create OrganizationServiceProxy in CRM2011 IFD

Creating OrganizationServiceProxy in crm2011 IFD vs AD different when it comes to setting credentials of the service proxy. In AD :- ClientCredentials clientCredentials=new ClientCredentials(); clientCredentials.Windows.ClientCredential = new NetworkCredential(userName, password,domain); In IFD :- clientCredentials.UserName.UserName =domain + @"\" + userName; clientCredentials.UserName.Password = password; OrganizationServiceProxy service = new Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy(organizationUri, HomeRealmUri, credentials, null);