Field flag getIsDirty() == false, why ?

Field flag getIsDirty() == false, why ?

Recently, I’ve came accross situation, that despite the fact that certain field has been change on CRM form, a javascrift flag getIsDirty() == false. I’ve  noticed that just after changing field value user is clicking ribbon button and that was the reason. Flag getIsDirty() is beeing set when form control loose focus – operating on […]

Get attribute value audit, history

Get attribute value audit, history

What for Sometimes, there is necessity of getting historical values for entity attribute. Of course to do so audit for organization, entity and attribute have to be turned on. Code below allows user, with proper privileges, to read attribute value audit. For sure if you need fancy validation this code is no good for that. […]

How to copy entire entity form ?

How to copy entire entity form ?

If you have several forms for entity, and you need to create new form based on previously created form there are two options: open form customization window and SaveAs simple copy form request can be used instead of inserting fields ony by one using Microsoft.Crm.Sdk.Messages; var stageAdapter = new CRMServiceAdapter("SERVER_NAME", "Stage"); var organizationService = stageAdapter.Proxy; […]

How to run code with elevated priviledge?

How to run code with elevated priviledge?

Sometimes code must be invoked with admin-user priviledge, e.g. when retrieving data to which invoking user has no access. In this scenario You can impersonate OrganizationService to other user only for time operation is executing. Invoking code which must be run with higher priviledged is extremely easy. Code is written just like it is in […]

Secure and Unsecure Configuration

Secure and Unsecure Configuration

Where it is used? When creating plugin in VisualStudio via DeveloperToolkit there is an option to provide some configuration. Configuration is a string field which can be represented witch simple string, XML, CSV or other schema.   Auto generated constructor is also created where both configurations are represented as plain string, which you can parse […]

Javascript SOAP or REST ?

Javascript SOAP or REST ?

  While writing javascript code it is the most fundamental question. Both ways are capable of CRUD operations, so what is the difference? Recently I’ve written some code to retrieve only one flag from opportunity entity at JS. Beside that JS entity had registered plugin at PreRetrieve.  Of course in plugin code I was checking if […]

How to use REST endpoint?

How to use REST endpoint?

REST endpoint is one way of retrieving data on client side. REST operations are using datasets, which  are treated as entity item collections. Personally the easiest way of using REST endpoint is to use XrmServiceTooltkit.REST library. Where to find datasets? http://servername:port/OrganizationName/XRMServices/2011/OrganizationData.svc/ … – <collection href=”new_errorSet“>   <atom:title>new_errorSet</atom:title>   </collection> … Where to find fieldnames used […]

How to send email to specific email address instead of CRM User/Enity ?

How to send email to specific email address instead of CRM User/Enity ?

At standard operation email is being sent to EntityReference object corresponding to: User, Contact etc. Entity reference is being converted anyway into ActivityParty object. So, why not to use ActivityParty just from email address collection: private const string HtmlMimeType = @"Content-Type: text/html; charset=UTF-8"; private const string PlainTextMimeType = @"Content-Type: text/plain; charset=UTF-8"; public void CreateEmail(string title, string […]

Where to find Server Address And Organization Name in plugin?

Where to find Server Address And Organization Name in plugin?

If you would create client application which use OrganizationServiceProxy answer to question is easy: var proxy = service as OrganizationServiceProxy; var scheme = proxy.EndpointSwitch.PrimaryEndpoint.Scheme; var serverAddress = proxy.EndpointSwitch.PrimaryEndpoint.Host; var organizationName = proxy.EndpointSwitch.PrimaryEndpoint.Segments.Length < 2 ? UndefinedValue : proxy.EndpointSwitch.PrimaryEndpoint.Segments[1].Replace("/", string.Empty); If you use LocalPluginContext organization name is available: localContext.PluginExecutionContext.OrganizationName But, what with other parameters, ex. servername […]