Implicit Dynamics CRM data-type conversion

by Daniel Halan 24. June 2010 00:29

When working with Microsoft CRM data-types using web services there is no constructor parameters due to limitations of the WSDL code generation. This leads to few lines of code each time one want to create a variable of any CRM type.

This can be optimized using a Factory class where you encapsle the creation of the desired class. But one even cleaner way is to create a partial class and define "implicit" operators between CRM data-type and .NET data-type.

Here is an example on how it works.

Standard way of assigning a .NET DateTime to CRM DateTime,

CrmDateTime cdt = new CrmDateTime();
cdt.Value = DateTime.Today.ToString("s");

Using implicit declaration,

CrmDateTime cdt = DateTime.Now;

and back,

DateTime dt = cdt;

The code behind this,

public partial class CrmDateTime {

  public CrmDateTime(DateTime dt) {
    this.Value = dt.ToString("s");
  }
  public static implicit operator CrmDateTime(DateTime dt) {
     return new CrmDateTime (dt);
  }
  public static implicit operator DateTime(CrmDateTime dt) {
     return DateTime.Parse(dt.Value);
  }
}

Tags: ,

.NET | CRM

Microsoft Word Add-in for CRM Configuration Manager

by Daniel Halan 19. May 2010 05:43
Here comes a requested add-in for ouputting all your Microsoft CRM Customizations to a Word document.

This add-in can be used for various scenarios,

Documentation

  • Document your work after it's finished, removing any possible mismatch from the specifications.
  • Understand the work of others when taking ownership of a CRM instance without any documentations provided (Using the filters to export only Custom Entities, Attributes and Relationships)
  • Presents all your ISV Configuration changes in one place, that usually are hard to get a good overview of.

Daily work routines

  • Development Aid, use a complete export document as a reference.
    By searching in the document for a specific entity you can quickly see available picklist values, implemented javascript, published attributes on form and attributes schema name including data type restrictions.
  • Architect Aid, Cut & Paste attribute, forms or relationships Tables to your specifications, and extend them with new values or describe changes.

The Add-in supports multi-language CRM installations, you select the prefered output language, and the base language will be used as fallback. You can also define to only export custom entities, attributes and relationsships making the document easier to read.

The document can contain following chapters,

  • Organisation Settings
    Configurations set for the selected organisation (tenant) i e Schema Name Prefix..
  • ISV Configuration
    All custom Menues, Navigation Items, Toolbar Buttons and Renamed titles
  • Workflows
  • Security Roles
  • Entities


Checkout sample document,
CCM Word Sample.docx (41,74 kb)

Only $99

Buy Now

Free version upgrades

Requirements
Docx File Format Viewer
Microsoft .NET Framework 3.5 or newer

CRM Configuration Manager v1.50

by Daniel Halan 19. May 2010 04:16

First of all, I would like to thank for all the positive response regarding CRM Configuration Manager, always a joy to hear that the product works :)

Here comes a new release of CRM Configuration Manager that contains some improvements and a new Extension Framework for creating Add-ins. The first extension interface available is for output handling. You can now implement a new document type handler for exporting. Could be used for various documentation formats, for example an Visio document handler, that would create a data model of the exported entities and their relationships.

A SDK will be released in the near future, but until then you can contact me for guidance.

Improvements and bugfixes included in version 1.50,

  • Improved 'Export only Modifications' function, now also checking modifications at Entity Forms and Relationships
  • Not all system entities was listed in the Entity view.
    Thanks to Daniel Jansen for reporting the issue.
  • Implemented Add-in framework for output document formats. 
  • Revised user interface to improve usability
  • Minor bug fixes

Complete list of features

CcmSetup1.55.exe (966,81 kb)

Also released an output Add-in for Microsoft Word document format,
read more about it here.

Happy Customization!

 

CCM: Non-Latin characters bug fixed

by Daniel Halan 19. March 2010 01:50

There was a little bug / oversight in CRM Configuration Manager when working with CRM installations with other languages then English. Non-Latin characters didn't get saved correctly due incorrect encoding. It has now been resolved by checking what languages are installed at the server.

The fix is included in v1.15

Thanks to Daniel Sabater for reporting the issue.

CRM Configuration Manager [Updated]

by Daniel Halan 27. February 2010 18:55

This is a follow up on my earlier project CRM Customization Manager, CRM Configuration Manager is a Windows application to create an Export / Import selection that can later be exported as a command prompt string for later use, or execute directly inside the application. The main features of CRM Configuration Manager are,

  • Easy access to the features of CRM Customization Manager
  • Possible to select a CRM server as destination, allowing one click export and import.
  • Create advance export/import selections for later use inside scripts / installations

This release includes CRM Customization Manager v2.0 that contains fixes and few new features,

  • JavaScript Export/Import, This allows you to extract JavaScript to a local folder, where you can work in a proper script editor, and later import them back. You can also create new javascripts in the same folder, just follow the name convention and they will also be imported to the correct entity / event.
  • Zip support, Now all features works with zipped customizations
  • Include Related Entities, This features will automatically include related entities to the selected entities, so their relationships are exported and can be reviewed for conflicts. This is recommended during the development process when relationships may change.
  • Publish Workflows, Publish operation now also publishes workflows

v1.0 key features...

I’m wondering, is there any interest in creating your own operations? That is, using a Plug-in model to add custom arguments to the application that will call your code before/after execution.

If you find the application useful, please donate to keep the development alive :)

Donate using PayPal

 

[Update 2010-05-18]
Version 1.5 Released, read more about it here

Get CCM v1.50

Happy Customizing!

Download

Changing Relationship Lookup attribute name

by Daniel Halan 3. January 2010 06:24

If one would like to change a relationship lookup field name on a entity, then it is important to change the name of the relationship.

For example, We have an entity called “EntityA” and it has a N:1 relationship with “EntityB”, the lookup attribute is currently called “entityb_conntectedid” and we would like to change the lookup attribute to “entitybid”. Then you normally would remove the relation, and add a new one setting the new name “entityid” to the lookup attribute.

Then you have to change the “relationship name” from the generated name “new_new_entitya_new_entityb” to for example “new_new_entitya_new_entityb2”. Otherwise there will be a conflict when importing the customizations to a CRM system that contains the old attribute making it impossible to publishing the entity if the old field exists on a form.

In the upcoming version of CRM Customization Manager (v2.0) I’ve included a warning message if one tries to import a customization that has a different name of the lookup to the same relationship so one can spot this before CRM gets broken. Also if the relationship is exported CRM Customization Manager solves the problem.

If you already have imported the new relationship and cannot publish / import the Entity, you can fix it by editing the CRM database. Access the table “OrganizationUIBase”, filter it by the ObjectTypeCode of your custom entity, then removing all the references to the old attribute in the “FormXml” column.

Related errors:
Cannot Export Customizations From Microsoft Dynamics CRM 4.0

Update:
CRM Configuration Manager now handles this.

Generics with CRM

by Daniel Halan 16. November 2009 23:17

Generics is a very nice feature of C# language, and can be used to simplify the CRM Web Service method calls. One of my responsibilities at Logica is to develop a framework for CRM development, and one of the main classes in this framework is called CrmSystem, it wraps the CrmService methods among other things. Using generics one can then type,

account acc = CrmSystem.Retrieve<account>(myAccountId);

also we use a special NameValue class CrmConditions to one of our Execute overloads, here is how it can look

List<account> acc = CrmSystem.Execute<account>(new CrmCondition("emailaddress1", "daniel@logica.com"));

This would retrieve all accounts that got the email "daniel@logica.com"

Here is one of the overloads for the Retrive Method that uses Generics, it calls an other overload that does the actual call to CRM Web Service using the EntityName string that we get thru typeof(T).Name


public
T Retrieve<T>(Guid id, params string[] columnSet) where T : BusinessEntity { 
     return
(T)Retrieve(typeof(T).Name, id, new ColumnSet(columnSet));
}

 

Hope this gives some inspiration for your own CrmApi wrappers :)

 


Tags: ,

.NET | CRM

CRM Customization Manager

by Daniel Halan 15. October 2009 23:20

During my time with Microsoft CRM 4 I’ve found some limitations of the import & export process of customizations, which led to the curiosity if one could fix those with a custom application. Thanks to the open architecture of Microsoft CRM with Web Services and Xml for customization management it was pretty easy to create a small application to improve the import and export process of customizations.


Here follows the main features of CrmCustomizeManager.

  • Console Application, Making it possible to import and export inside nant, msbuild or bat scripts, for example to export the customization each night and “check in” to a source code repository, enabling version control of the customizations. Also to import customizations directly from a MSI installation.
  • Export Only Modifications, You can export a “clean” customization xml in the beginning of a project and save it in the application folder as “CleanCustomization.xml”, the application will compare the current state and only export the entities that are modified or added.
  • Remove Deleted Attributes, This feature only applies when importing a customization. When this operation is selected one will be prompted with all attributes that has been removed in the new customization, given the possibility to remove them from the CRM instance.
  • Changes Attribute data type, When changing an attributes data type and then trying to import it to a CRM instance that still contains the old attribute would normally generate an error. This is now handled and the data inside the old attribute will be converted to the new data type (when possible and logical)
  • Publish, You can publish the customizations, can also be used at it’s own, for example assigning it to a system wide hotkey for fast access.
  • Node & Entity Selection, you can select what nodes and entities to import and export. For example only export ISV Config or the Site Map. Possible items to select,

    Entities Workflows Roles ISV Config
    Sitemap Templates Calendar Settings General Settings
    Email Settings Marketing Settings Outlook Synchronization AutoNumbering Settings
    And more…      

Get Latest version.

 

kick it on DotNetKicks.com

Blog3ngine dot NET 1.6.1.2
Theme by Daniel Halan

About the author

Daniel Halan Daniel Halan, M.Sc. systems architect in Sweden.

Working primary with Microsoft .NET, Dynamics CRM, XRM & Web Read more...

The content of this site are my own personal opinions and do not represent my employer's view in anyway.


Follow Me
Interesting, online accelerator/incubator for start-ups http://t.co/Xld5ETYD #startup 18 Jan 2012

Microsoft Dynamics Salary Survey 2012

Nigel Frank International would like to invite you to complete our annual survey of global Microsoft Dynamics salaries. The survey will only take a couple of minutes to complete and your response and any personal details will be kept strictly confidential.

Prizes,
1st  iPad2 16gb Wi-Fi + 3G 
2nd Xbox 360 + Kinect 
3rd Kindle Keyboard w/ Free 3G + Wi-Fi 
4th MS LifeCam Studio Webcam 
5th MS Arc Touch Mouse 

You will also receive a FREE copy of the Salary Survey report once it has been compiled. 

Take the Salary Survey 
The survey is available in 12 languages for your convenience.