Thursday, May 18, 2017

Export System Settings with a Solution

When we export a solution in CRM it always asks for some settings to be exported from the system and often most would ignore this and would export the components that needs to be exported. When there are any system wide setting changes that need to be changed a system administrator would go and do this manually.

This is sometimes bit of a pain as if you miss any of this there would be possibility of the system not working as it supposed to do.

Luckily Microsoft is giving the option to include them with your solution and this has been there from a long time.  However not all of the system settings can be exported, but a lot can be done. The following technet article describes what can be exported.

Try using this feature if you haven’t the next time when you want to include system settings with the solution.

Sunday, May 14, 2017

Update Modified-On Field using Kingsway Soft for CRM Data Migrations

In the previous blog I mentioned that this cannot be done as the fields doesn’t get displayed via the Kingsway tool. There is nothing wrong with it when you think about the scenario as the modified-on field should actually be set to the time a record has been modified in CRM. This would be set to the time when the record is updated via the web services.

However in most of the data migration the client needs asks the data migration team to set the modified on time to the last updated time of the record in their previous system. This is more important to them than the actual created on time of the record in the previous system.

Now the problem would be we cannot set this to modified-on time in CRM via the tool. We can set this time to the created on time via the tool and most of the client would be agreeing to it (Please note when you do this you cannot set the actual created on time of the record). Also please note that you have to set the updated on date to overridecreatedon field in the Kingsway soft tool. (You should be having a security role which has permission to update this field)

But some clients are adamant that they want to see the same date time value in the modified on time. This can be achieved by a simple plugin.

The plugin has to be registered in the pre create of the entity that you are migrating the data to. It should be having the following code. After this is set your modified on time would be set to the actual updated time from the previous system. I was greatly helped by the following blog post to get an idea about this.

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
                //get the entity from the input parameters
                Entity entity = (Entity)context.InputParameters["Target"];

                if (entity.Attributes.Contains("createdon") && entity["createdon"] != null)
                    //assign the modifiedon time to the created time for dm
                    entity["modifiedon"] = entity["createdon"];

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...