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

image

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

Comments

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"));
break;
case 2:
inputData.set_Item("mctools_globalvalue", inputData.get_Item("mctools_memovalue"));
break;
case 3:
inputData.set_Item("mctools_globalvalue", (bool) inputData.get_Item("mctools_boolvalue") ? (object) "Oui" : (object) "Non");
break;
case 4:
inputData.set_Item("mctools_globalvalue", (object) ((int) inputData.get_Item("mctools_integervalue")).ToString());
break;
case 5:
inputData.set_Item("mctools_globalvalue", (object) ((Decimal) inputData.get_Item("mctools_decimalvalue")).ToString());
break;
case 6:
inputData.set_Item("mctools_globalvalue", (object) ((float) inputData.get_Item("mctools_floatvalue")).ToString());
break;
case 7:
inputData.set_Item("mctools_globalvalue", (object) ((DateTime) inputData.get_Item("mctools_datevalue")).ToString("dd/MM/yyyy"));
break;
}
}
Thank you tanguy.. it is fine.. working with me...
thank you tanguy for given Storing custom configuration settings in Microsoft Dynamics CRM
Unknown said…
This is really interesting, You are a very skilled blogger. Thanks for sharing with us

Popular posts from this blog

Use feature flags in your plugins

New XrmToolBox plugin : Import/Export NN relationships

Searchable Propery Attribute Updater