Exporting Mobile Offline Profile as a Solution Automatically Add Dependent Components
SYMPTOM
When a solution containing a Mobile Offline Profile is exported, the system automatically adds the dependent components of the entities (from the Mobile Offline Profile) into the solution without any confirmation.It can be a problem when the deployment is done for selected components and not all of the changes are going to the target environment (not going to be completely in-sync). It is tricky when automatically added dependent components may contain the unwanted ones which are not planned to be deployed.
CAUSE
According to Microsoft Support, this is a by-design behaviour. When exporting a profile, it takes a dependency on the metadata of each entity in the profile.If there are any unmanaged customizations to the entity or the forms on the entity, then it will end up pulling those as well. It will also pull any unmanaged dependencies that the entity has.
For example, we have unmanaged customization to a form on an entity to add a web resource. This will add a dependency between the entity metadata and the web resource. Then create a solution that contains a profile that contains the entity that has the customized form. When we export that solution it will contain:
- The profile
- All Assets of that entity in the profile (all forms, views, fields, etc.)
- The web resource (referenced in the form)
- The entity metadata (of any other entities related to the one at no.2 such as lookup entity)
This is because the profile depends on the entity metadata for that entity, and the entity metadata for that entity depends on the web resource. (the same applies to the OptionSet and Security Role referenced on the form)
There is no workaround for this behaviour currently and (I was told that) Microsoft DEV team is *working on it*.
WORKAROUND SOLUTION
Even though Microsoft Support told me that there is no workaround for this behaviour (probably from the solution export perspective), I found a way to deploy the Mobile Offline Profile from one environment to another without using solution package.The workaround solution that I did was by transferring the Mobile Offline Profile records using Data Transporter plugin from XrmToolBox (there is no option to option to select the "Mobile Offline Profile" table in the Configuration Migration Tool). After all, Mobile Offline Profile is just a set of records which consists of Mobile Offline Profile, Profile Item and Profile Item Association. All you have to do is transferring the records of these 3 entities in order.
If you are going to transfer all custom Mobile Offline Profiles (unmanaged), you just need to use the following FetchXML filter in Data Transporter to transfer. (to exclude out-of-the-box managed Mobile Offline Profiles)
<filter>
<condition attribute="ismanaged" operator="eq" value="0" />
</filter>
Upon transferring Mobile Offline Profile Item Association, Shows the relationship (relationshipid) attribute may need to be unselected if it causes the failure for some of the records.
Hi Linn. Thanks for great work around. Did u try configuration migration tool? Should do the same trick.
ReplyDeleteI didn't try Configuration Migration Tool (by the time of writing this post). I tried it after reading your comment but in the first step of creating schema, I don't see an option to select the "Mobile Offline Profile" table (entity) from the Default Solution even though I can see that entity in the solution explorer.
Delete