Skip to main content

Posts

Showing posts from February, 2009

Abort event through plugins

Suppose you are writing a pre -event plugin in which you compare to  old and new values and on certain condition would like to cancel the Save or  Update and stop the execution, it was simple in CRM 3 with an Abort() method while in CRM 4, you have to manually raise and throw a  Invalid-Plugin-Exception, while this gives a dirty error message on your MSCRM screen, you can make it better by entering you own Message explaining why the record could not be saved: throw new InvalidPluginExecutionException("Execution has been stopped due to this reason");

IME Mode in MSCRM attribute settings

When you create a new attribute for a MSCRM entity or open an exisitng one to see it's characteristics like data type, min-max values and schema name, you would have seen a property called IME mode, if you would've wondered what it is like me, here is what is got from the MSCRM Online resources :  An Input Method Editor (IME) lets you to enter and edit Chinese, Japanese, and Korean characters. These Asian writing systems have more characters than can be encoded for a regular keyboard. The IMEs for these languages use sequences of base characters that describe an individual character or group of characters to enter a larger set of characters. Base characters can be component letters from Hangul syllables, phonetic components for Japanese kanji characters, or various combinations for Chinese characters. You can use the IME mode option to quickly enter these characters and symbols into text boxes, avoiding the manual switch to IME mode that would otherwise be required. Input Metho...

Retrieve custom entity and attributes by Microsoft.Crm 4 Sdk

CrmAuthenticationToken token = new CrmAuthenticationToken(); token.OrganizationName = " "; token.AuthenticationType = 0; Microsoft.Crm.SdkTypeProxy.CrmService service = new Microsoft.Crm.SdkTypeProxy.CrmService(); service.Url= "http://localhost:5555/mscrmservices/2007/crmservice.asmx"; service.CrmAuthenticationTokenValue = token; service.Credentials = System.Net.CredentialCache.DefaultCredentials; service.UnsafeAuthenticatedConnectionSharing = true;   Microsoft.Crm.Sdk.Query.QueryExpression query = new Microsoft.Crm.Sdk.Query.QueryExpression("mycustomentity"); query.ColumnSet.AddColumn("mycustomentityid"); query.ColumnSet.AddColumn("name"); query.ColumnSet.AddColumn("number"); query.Criteria.AddCondition("name", ConditionOperator.Equal, "Chandresh");   RetrieveMultipleRequest requestAccount = new RetrieveMultipleRequest(); requestAccount.Query = query; requestAccount.ReturnDy...

Extra events in MS CRM entity form

When you want to make some updates in CRM on the entity form like set certain values or do some computation, two events you can rely on is onLoad and onSave. What if users don't want to press a button, say Save, especially in the case of a record of a related entity being added or created with the entity of which form you have opened, there is no way to track the updated in number of records being added or removed from the related entity, what you do then other than OnSave ?  Classic javascript has the answer, like any other webform, you get standard window events like onload,  onunload:  which is the event to be called when you close the window, i.e click on the rightmost cross button  [X]  at anytime, and also  onblur : which is when you move on the another window or just go to desktop loosing the focus of the active window which is the MS CRM form.   So you can run some javascript code on these events by defining a custom handler function for these events which would not be hand...