Solution Component types in Dynamics 365

CRM 2016 brought one great improvement – possibility to choose what subcomponents we want to include in the solution. We can choose single fields, views or relationships for an entity. Previously when an entity has been added to a solution, all its subcomponents were automatically added to this solution. This great feature allows to better control what is transferred between environments. Who has never imported a view or some chart that was changed on testing environment to live environment, by accident, please raise your hand. Currently we can include only the components that were changed and make sure nothing else will come along. Of course, it requires changing the mindset – quite recently I was asking a many-year CRM customizer, why he has added all components for Account entity to our solution, if the only thing that was changed were few added fields. “Because it always was like that” is not satisfying answer for me, as you probably already figured out 🙂

Because of this new feature, I believe that it’s important to better understand what is in fact kept in the solution from the metadata and data perspective. Every element in a solution is called Solution Component. It’s a simple entity that has a type and few values that help identify it (like ObjectId) if it’s a metadata or data component and if it includes all Subcomponents, does not include subcomponents or is only a shell of a component. Documentation on MSDN (https://msdn.microsoft.com/en-us/library/mt608054.aspx) clearily defines all solution component types, and the most important fields, which are:

  • componenttype: The object type code of the component.
  • ismetadata:  Indicates whether this component is metadata or data. (1 : Metadata, 0 : Data)
  • objectid: Unique identifier of the object with which the component is associated
  • rootcomponentbehavior: Indicates the include behavior of the root component (0 : Include Subcomponents, 1 : Do not include subcomponents, 2 : Include As Shell Only)
  • rootsolutioncomponentid: The parent ID of the subcomponent, which will be a root

I researched all available solution components. Below you can find a summary of their names, logical names, short description and how to get them using SDK. Basically there are three ways of getting this data using SDK:

  1. Using dedicated OrganizationRequest: for example EntityMetadata, AttributeMetadata etc
  2. Using RetrieveRequest (or simply IOrganizationService Retrieve message)
  3. Using RetrieveMultiple specifying QueryExpression with proper entity name and id equal to ObjectId from Solution Component object. Don’t ask me why simple Retrieve does not work for this components – it simply does not.

Interesting thing is that some components are known as not-transferable through solution (like Duplicate Detection Rules). I will try to investigate in the future if it’s possible to add them to the solution using SDK and successfully transfer to another environment using solution.

UPDATE: I investigated if it’s possible to add a solution component that is listed below, but it’s not available through UI, so for example Duplicate Detection Rule:

var solutionComponentRequest = new AddSolutionComponentRequest()
{
    ComponentType = 44,
    ComponentId = duplicateRule.Id,
    SolutionUniqueName = "solutionName"
};
 
service.Execute(solutionComponentRequest);

Unfortunately such operation ends with with an exception:

An unhandled exception of type 'System.ServiceModel.FaultException`1' occurred in Microsoft.Xrm.Tooling.Connector.dll
Additional information: Invalid component type provided 44

Solution components summary:

TypeNameLogicalnameCommentSDK
1Entityn/aEntity metadataRetrieveEntityRequest
2Attributen/aAttribute metadataRetrieveAttributeRequest
3Relationshipn/aRelationship metadata, but it’s always bound to EntityRelationship metadata, internalObtained together with EntityMetadata using RetrieveRelationshipRequest
4AttributePicklistValuen/aValue of the option set option, internal
5AttributeLookupValuen/aValue of the lookup text,

internal

6ViewAttributen/aAttributes used in views, internal
7LocalizedLabeln/aLocalized label (metadata in CRM that you can localize)RetrieveLocLabelsRequest
8RelationshipExtraConditionn/aRelationship metadata, internalObtained together with EntityMetadata using RetrieveRelationshipRequest
9OptionSetn/aOption set metadataRetrieveOptionSetRequest
10EntityRelationshipn/aEntity relationship metadataRetrieveRelationshipRequest
11EntityRelationshipRolen/aRelationship role (feature depreciated since CRM 2011, after introducing Connections)
12EntityRelationshipRelationshipsn/aMapping between EntityRelationship and Relationship, internalObtained together with EntityMetadata using RetrieveRelationshipRequest
13ManagedPropertyn/aManaged property metadataRetrieveManagedPropertyRequest
14EntityKeyn/aEntity key metadataRetrieveEntityKeyRequest
20RoleroleSecurity roleRetrieveRequest (Target = role)
21Role PrivilegeroleprivilegesSecurity role privilegeRetrieveRequest (Target = roleprivileges)
22Display StringdisplaystringDisplay stringRetrieveRequest (Target = displaystring)
23Display String Mapdisplaystringmap Display string mapping RetrieveRequest (Target = displaystringmap)
24Form forminternal
25Organizationorganization Organization entity RetrieveRequest (Target = organization)
26Saved Querysavedquery View RetrieveRequest (Target = savedquery)
29Workflowworkflow Process RetrieveRequest (Target = workflow)
31Reportreport Report RetrieveRequest (Target = report)
32Report Entityreportentity Entity bound to report RetrieveRequest (Target = reportentity)
33Report Categoryreportcategory Category of report RetrieveRequest (Target = reportcategory)
34Report Visibilityreportvisibility Visibility of report RetrieveRequest (Target = reportvisibility)
35Attachmentattachment Attachment entity RetrieveMultiple request using QueryExpression(“attachment”)
36Email Templatetemplate Email template RetrieveRequest (Target = template)
37Contract Templatecontracttemplate Contract template RetrieveRequest (Target = contracttemplate)
38KB Article Templatekbarticletemplate KB Article template RetrieveRequest (Target = kbarticletemplate)
39Mail Merge Templatemailmergetemplate MailMerge template RetrieveRequest (Target = mailmergetemplate)
44Duplicate Ruleduplicaterule Duplicate rule RetrieveRequest (Target = duplicaterule)
45Duplicate Rule Conditionduplicaterulecondition Duplicate rule condition RetrieveRequest (Target = duplicaterulecondition)
46Entity Mapentitymap Entity mapping RetrieveRequest (Target = entitymap)
47Attribute Mapattributemap Attribute mapping RetrieveRequest (Target = attributemap)
48Ribbon Commandribboncommand Ribbon command RetrieveMultiple request using QueryExpression(“ribboncommand”)
49Ribbon Context Groupribboncontextgroup Ribbon context group RetrieveMultiple request using QueryExpression(“ribboncontextgroup”)
50Ribbon Customizationribboncustomization Ribbon customization (Application Ribbon) RetrieveMultiple request using QueryExpression(“ribboncustomization”) or you can use RetrieveApplicationRibbonRequest
52Ribbon Ruleribbonrule Ribbon rule RetrieveMultiple request using QueryExpression(“ribbonrule”)
53Ribbon Tab To Command Mapribbontabtocommandmap Ribbon tab to command mapping RetrieveMultiple request using QueryExpression(“ribbontabtocommandmap”)
55Ribbon Diffribbondiff Ribbon diff RetrieveMultiple request using QueryExpression(“ribbondiff”)
59Saved Query Visualizationsavedqueryvisualization Chart RetrieveRequest (Target = savedqueryvisualization)
60System Formsystemform Form RetrieveRequest (Target = systemform)
61Web Resourcewebresource Web resource RetrieveRequest (Target = webresource)
62Site Mapsitemap Site map RetrieveRequest (Target = sitemap)
63Connection Roleconnectionrole Connection role RetrieveRequest (Target = connectionrole)
65Hierarchy Rulehierarchyrule Hierarchy rule RetrieveRequest (Target = hierarchyrule)
66Custom Controlcustomcontrol Custom control RetrieveRequest (Target = customcontrol)
68Custom Control Default Configcustomcontroldefaultconfig Custom control default config RetrieveRequest (Target = customcontroldefaultconfig)
70Field Security Profilefieldsecurityprofile Field Security Profile RetrieveRequest (Target = fieldsecurityprofile)
71Field Permissionfieldpermission Field permission RetrieveRequest (Target = fieldpermission)
80App Moduleappmodule App moduleRetrieveMultiple request using QueryExpression(“appmodule”)
90Plugin Typeplugintype Plugin type RetrieveRequest (Target = plugintype)
91Plugin Assemblypluginassembly Plugin assembly RetrieveRequest (Target = pluginassembly)
92SDK Message Processing Stepsdkmessageprocessingstep Plugin step RetrieveRequest (Target = sdkmessageprocessingstep)
93SDK Message Processing Step Imagesdkmessageprocessingstepimage Plugin step image RetrieveRequest (Target = sdkmessageprocessingstepimage)
95Service Endpointserviceendpoint Service endpoint RetrieveRequest (Target = serviceendpoint)
150Routing Ruleroutingrule Routing rule RetrieveRequest (Target = routingrule)
151Routing Rule Itemroutingruleitem Routing rule item RetrieveRequest (Target = routingruleitem)
152SLAsla Sla agreement RetrieveRequest (Target = sla)
153SLA Itemslaitem Sla item RetrieveRequest (Target = slaitem)
154Convert Ruleconvertrule Automatic creation rule RetrieveRequest (Target = convertrule)
155Convert Rule Itemconvertruleitem Automatic creation rule item RetrieveRequest (Target = convertruleitem)
161Mobile Offline Profilemobileofflineprofile Mobile offline profile RetrieveRequest (Target = mobileofflineprofile)
162Mobile Offline Profile Itemmobileofflineprofileitem Mobile offline profile item RetrieveRequest (Target = mobileofflineprofileitem)
165Similarity Rulesimilarityrule Similarity rule RetrieveRequest (Target = similarityrule)

Authors:

Pawel Gradecki

Subscribe to oneDynamics

Sign up now to get access to the library of members-only issues.
Jamie Larson
Subscribe