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; […]

Reset CRMAppPool with all services

Reset CRMAppPool with all services

Sometimes there is need to perform “deep” reset of entire IIS envirionment. To do so You can use powershell script: $CRMSnapin = 'Microsoft.CRM.PowerShell'; if ( (Get-PSSnapin -Name $CRMSnapin -ErrorAction SilentlyContinue) -eq $null ) { Add-PSSnapin $CRMSnapin } #iisreset # Recycle only CRM Application Pool to free dlls. C:\Windows\System32\inetsrv\appcmd recycle apppool /apppool.name:CRMAppPool C:\Windows\System32\inetsrv\appcmd recycle apppool /apppool.name:CrmDeploymentServiceAppPool […]

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 […]

Schema Name vs Logical Name

Schema Name vs Logical Name

When we are creating an entity field,  the Name we give is its schema name. After creating field the schema name also becomes the logical name. The values are same but with one difference, the casing. Example: DisplayName: NewFieldName Name: new_NewFieldName (schema name) LogicalName: new_newfieldname Where both names are used ? SchemaName: early bounding (ServiceContext), crmsvutil […]

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 […]