Search This Blog

Tuesday, February 18, 2014

Storing custom configuration settings in Microsoft Dynamics CRM

Since some years, I’m using two custom entities to store some parameters used in JavaScript, Plugins and Custom Workflow Activities. As I have been asked to share them with the community, I’m doing it today?

I have created a managed solution that contains these two entities:

  • Parameters Category : Used to define parameters groups
  • Category : This is the main entity that stores the parameter with the following attributes:
    • Name : This is a display name that can be changed anytime
    • Logical name : This is a name editable only during creation
    • Category : To indicate in which group of parameters the parameter belongs
    • Description : no need of explanation here
    • Value type : define the type of value
    • Value : depending of the type, the appropriate control is displayed. When saving the value is also copied to a global text attribute named “global value”

This way, I can store typed parameters for multiple usages:

  • Storing counter current value
  • Storing url of an external application
  • Storing a date of a last execution of any process
  • Setting a debug flag to display additionnal information in some process
  • etc.

Here is a screenshot of the form


The solution supports French and English languages and is compatible with Microsoft Dynamics CRM 2011 and 2013.

As usual here, the solution is available on CodePlex


Andy said...

tanguy, there's a bug in the plugin on update (the given key was not present in the dictionary)

Andy said...

private static void CopyLocalToGlobal(Entity inputData)
switch (((OptionSetValue) inputData.get_Item("mctools_valuetype")).get_Value())
case 1:
inputData.set_Item("mctools_globalvalue", inputData.get_Item("mctools_textvalue"));
case 2:
inputData.set_Item("mctools_globalvalue", inputData.get_Item("mctools_memovalue"));
case 3:
inputData.set_Item("mctools_globalvalue", (bool) inputData.get_Item("mctools_boolvalue") ? (object) "Oui" : (object) "Non");
case 4:
inputData.set_Item("mctools_globalvalue", (object) ((int) inputData.get_Item("mctools_integervalue")).ToString());
case 5:
inputData.set_Item("mctools_globalvalue", (object) ((Decimal) inputData.get_Item("mctools_decimalvalue")).ToString());
case 6:
inputData.set_Item("mctools_globalvalue", (object) ((float) inputData.get_Item("mctools_floatvalue")).ToString());
case 7:
inputData.set_Item("mctools_globalvalue", (object) ((DateTime) inputData.get_Item("mctools_datevalue")).ToString("dd/MM/yyyy"));

Microsoft Dynamics CRM said...

Thank you tanguy.. it is fine.. working with me...

microsoft dynamics crm said...

thank you tanguy for given Storing custom configuration settings in Microsoft Dynamics CRM

My Sap Gurus said...

This is really interesting, You are a very skilled blogger. Thanks for sharing with us