Alternate Keys in CRM 2015\CRM 2016


Let us look at a simple example to understand.

  • Suppose we have a custom entity name Demo Entity.
  • Create a new single line of text field named Alternate Key Field.
  • Create a new Alternate Key Field and specify the above field for it.

  • Click on “Create index for My Alternate Keys for entity Demo Entity” which will create an Index in CRM’s Database.
  • Let us update the following record using Alternate Key

  • Sample code

  • Updated record

  • Currently alternate key can only be defined on field type – string, integer and decimal.
  • The alternate key can be used for Entity Reference as well, wherein instead of specifying GUID we can now use alternate key.

Hope it helps..

Plug-in and Custom Workflow activity tracing in CRM 2015\CRM 2016.


To configure it,

Go to Settings – Administration – System Settings

Here we have selected “All” for enable tracing and registered a sample plugin which only writes trace.

Now perform the event that will trigger the plugin.

Go to Settings – Plugin Trace Logs

Open the Trace Log record

Trace message

In case of enable logging set as Off no trace log records will be created and in case of Exception only when exception occurs trace log record is created.

“Trace logs older than 24 hours are deleted by Bulk Deletion background job”

Hope it helps..

How to – Use RetrieveEntityChangeRequest to track changes in CRM 2015 / 2016.


As a first step,

Enable Change Tracking for the entity, custom Demo Entity in our case here.

Suppose we have 5 records created for Demo Entity.

As we are calling it for the first time DataVersion is set as empty.

We got all the 5 records as new or updated item.

Save the DataToken to be used while determining the changes and to be passed next time.

Now let us delete Record 1 and Record 2 and update Record 5 and run the code again this time passing the DataToken saved

As expected we get 3 changes.

Now suppose we create a new record name Record 6 and still use the old Data Token

As expected we got 4 changes here, which includes the new record 6 as new or update.

Point to remember here is if no version is passed the system will return all the records as new, and system will consider records that are within 90 days, if it is older than 90 days all the records will be returned.

If we have a new record created and deleted before we retrieved for the changes and the record didn’t exist at the time of retrieval, we will still get the record as deleted.

Sample Code

</p>
<p>EntityCollection newOrUpdatedEntityCollection = new EntityCollection();<br />
EntityReferenceCollection removeOrDeletedEntityRefCollection = new EntityReferenceCollection();</p>
<p>RetrieveEntityChangesRequest retrieveEntityChangeRequest = new RetrieveEntityChangesRequest();<br />
retrieveEntityChangeRequest.Columns = new ColumnSet();<br />
retrieveEntityChangeRequest.Columns.AddColumn("new_name");</p>
<p>// pass DataVersion<br />
retrieveEntityChangeRequest.DataVersion = "1018501!10/24/2016 12:31:46";</p>
<p>retrieveEntityChangeRequest.EntityName = "new_demoentity";<br />
retrieveEntityChangeRequest.PageInfo = new PagingInfo();</p>
<p>RetrieveEntityChangesResponse retrieveEntityChangesResponse = (RetrieveEntityChangesResponse)organizationProxy.Execute(retrieveEntityChangeRequest);</p>
<p>foreach (var entity in retrieveEntityChangesResponse.EntityChanges.Changes)<br />
{<br />
var dataToken = retrieveEntityChangesResponse.EntityChanges.DataToken;</p>
<p>if (entity.Type == ChangeType.NewOrUpdated)<br />
{<br />
newOrUpdatedEntityCollection.Entities.Add(((NewOrUpdatedItem)entity).NewOrUpdatedEntity);<br />
}<br />
else if (entity.Type == ChangeType.RemoveOrDeleted)<br />
{<br />
removeOrDeletedEntityRefCollection.Add(((RemovedOrDeletedItem)entity).RemovedItem);<br />
}<br />
}</p>
<p>

Hope it helps ..

Advertisements

CRM Manipulation Library – Custom Workflow Activities for CRM 2016


Hi,

Recently we used the CRM Manipulation Library for some Days related calculation.

https://manipulationlibrary.codeplex.com/

To use it in CRM 2016, we updated the references to use latest SDK assemblies. You could download it form here.

https://www.codeplex.com/Download?ProjectName=manipulationlibrary&DownloadId=1614740

While working with it we found a strange issue,

If we are using Add Days and we do not specify any value to Days to Add it will not perform any calculation. The workaround suggested was to add 1 Week and remove 7 days, something of that sort. Basically, we wanted to add 2 minutes here.

Thanks to this post for that

http://practical-crm.blogspot.in/2013/12/crm-manipulation-library-date.html

Hope it helps..

How to – Delete Components from Managed Solution in Dynamics CRM 2016 without using Holding Solution.


Before the updates that we have received for solution in CRM 2016 the only way to delete components from managed solution was to use Holding Solution.

The following post nicely explains this.

https://blogs.msdn.microsoft.com/devkeydet/2012/05/29/deleting-things-from-a-deployed-crm-2011-managed-solution-package/

Now let us see how we can do this in CRM 2016 without using Holding Solution.

Suppose below is our managed solution that includes 2 Action, 2 Entity, 2 SLA, 2 Workflow.

Entity 2 with two forms.

Entity 2 with 2 Views.

Entity 2 with two Fields.

Now import this solution as managed in destination org.

Now suppose we do not want following components in our Destination org – action 2, dashboard 2, Report 2, Security Role 2, Workflow 2 etc. along with View 2, Field 2 and Form 2 for Entity 2.

We remove some of the components and delete (field, form etc.) from our unmanaged solution (named Core Solution) which we had imported as Managed in our Destination Org.

Deleted View 2

Deleted Field 2

Now click on “Clone to Solution“. (This will increment the version number.)

Now import this updated solution to our destination organization, and select “Stage for Upgrade

Click on “Apply Solution Upgrade

This will remove the components from our destination org.

The helpful post

http://www.inogic.com/blog/2016/08/how-to-delete-component-from-managed-solution-in-dynamics-crm-2016/

Hope it helps..

“​SharePoint Attachment Extractor & Metadata Manager” tool for Microsoft Dynamics CRM


Two of the most common requirements of the users while using OOB CRM and SharePoint integration have been

  • To associate some sort of metadata with the  document being uploaded from CRM
  • Moving attachments from notes of a particular record to the corresponding folder in SharePoint.

Finally we have a tool than enhances the Out the box integration between CRM and SharePoint and provides these features (in a fully supported manner)

Get all the details here :

https://debajmecrm.com/2016/10/05/new-tool-dynamics-crm-sharepoint-metadata-manager-attachment-extractor/

The tool has been developed by one of my closest friends and now also a MVP for Microsoft Dynamics CRM – Debajit Dutta.