Monday 8 December 2014

Microsoft Dynamics CRM e-book: Personal Dashboard for End Users

Hi,

Recently, I have requirement to conduct training for end users about Personal/User Dashboard, so I tried to create an e-book and I would like to share my thought, knowledge, and training material here.

Just in case in the future we have another training so that I hope this can be useful for you.

Overall, this e-book will help you to:

*As Trainer/Partner:
- Provide e-book for customers
- Use it as Training Material
- Improve knowledge

*As End Users:
- Learn how to create, customize, configure, and manage Personal Dashboard in Microsoft Dynamics CRM
- And not only Dashboard, but also how to Create New Personal View and New Personal Chart
- How to put and mix it together and build this into a meaningful Data Analytic Tool

This e-book is in full color and full visualization edition which I hope can help you to get the core essence.

And here we go..



Download source: Click Me!

Thank you for Microsoft and another blog references.

Thank you all!

Monday 1 December 2014

How to Update Activity Entity Record When Completed/Canceled Using CRM SDK C#

As we know, in the activity entity, after you completed or close/canceled an activity record, you cannot modify any value of this activity record. Well, it happened to any entity and you might need to re-open it first. But, sometimes, you need to update some fields when you cancel or complete activities, such as you want to give additional description, you want to save field based on the regarding field, or you want to add some calculation inside when you close any activities.

So, here we are, this is the code to update field when you close the activity, you need a plugin.

public void Execute(IServiceProvider serviceProvider)
        {
            #region must to have

            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

            // Create service with context of current user
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

            //create tracing service
            ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            #endregion

            string strStatus = string.Empty;

            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {

                //create entity context
                Entity entity = (Entity)context.InputParameters["Target"];

                if (entity.LogicalName != TFP.Xrm.Contoso.Task.EntityLogicalName)

                    return;

                try
                {
                    if (entity.Contains("statecode"))
                    {
                        //Update the description
                        strStatus = GetStateCodeText(service, entity.LogicalName, "statecode", 
                            ((OptionSetValue)entity["statecode"]).Value);
                        
                        //update the description field
                        entity["description"] = String.Format("{0} on {1}", strStatus, DateTime.Now.ToString("dd/MM/yyyy"));
                    }
                }
                catch (Exception ex)
                {
                    throw new InvalidPluginExecutionException(ex.Message);

                }

            }
        }



The most notable is this line:
if (entity.Contains("statecode"))
{


}

You can have your own logic, in my scenario is I want to update the description field in Task entity to capture the status (in text) + the time, I am sure that you guys have your own scenario Smile, for example update another field based on the status and so one.

And the most important thing is you need to register this plugin onPreUpdate

image

Result:

image

See the updated Description field below.

image

Hope this helps!

Thanks.