Category Archives: Dynamics CRM 2013

Converting Managed Solutions to Unmanaged Solutions CRM 2013

Okay, so recently we needed to convert a managed solution into unmanaged solution to recover the lost files for Dynamics CRM 2013, but the question was HOW? Our unmanaged solution was lost and we were only left with the Managed solution.(I hope no one ever gets into this situation :) )
After Googling this issue (like we all do :) ) I found this solution which didn’t work in my case. It was for Dynamics CRM 2010.

1. Unzip the Managed Solution .zip file to your computer.
2. Open the ‘solution.xml’ file from within the Solution folder.
3. Find the <managed> tag on approximately line 9.
4. Change the value from ‘1’ (Managed) to ‘0’ (Unmanaged).

Editing the solution.xml

5. Save the ‘solution.xml’ file.
6. Zip the solution again by selecting all the files within the solution folder and either using WinRAR or simply by right clicking and selecting Send to > Compressed (zipped) folder.
7. The Zip file that gets created is the new Unmanaged Solution file. Import this into CRM as usual to start using the Unmanaged Solution.

 Sadly, this didn’t work!

THEN I found another interesting yet risky way of doing this for Dynamics CRM 2010 and tried to give it a shot This technique was demonstrated at TechED 2012, but I wasn’t sure if it would work for Dynamics CRM 2013 or not. AND IT WORKED! :)

Following are the steps to convert a managed solution to unmanaged one:

1. Create a new staging organization in Dynamics CRM 2013 (lets say StagingOrg)

2. Import the managed solution you want to convert to unmanaged in this Organization (StagingOrg).

3. Now connect SQL server from the database of StagingOrg and run this Query after changing the name of your managed solution accordingly.

declare @solutionId uniqueidentifier, @systemSolutionId uniqueidentifier

-- specify the uniquename of the managed solution you'd like to unmanage here it is StagingOrg
select @solutionId = solutionid from SolutionBase where UniqueName='StagingOrg'

select @systemSolutionId = solutionid from SolutionBase where UniqueName='Active'

update PublisherBase set IsReadonly=0 
	where PublisherId in (select PublisherId from SolutionBase where SolutionId=@solutionId)

print 'updated publisher'

-- tables below will be captured by the generic looper
--update SolutionBase set IsManaged=0 where SolutionId=@solutionId
--print 'updated publisher and solution'

--update PluginAssemblyBase set IsManaged=0 where SolutionId=@solutionId
--update PluginTypeBase set IsManaged=0 where PluginAssemblyId in (
--	select PluginAssemblyId from PluginAssemblyBase where SolutionId=@solutionId
--update SdkMessageProcessingStepBase set IsManaged=0 where SolutionId=@solutionId
--update SdkMessageProcessingStepImageBase set IsManaged=0 where SolutionId=@solutionId
--print 'updated plugins and messages'

--update WebResourceBase set IsManaged=0 where SolutionId=@solutionId
--print 'updated web resources'

--delete from DependencyBase where DependentComponentNodeId in (
--	select DependencyNodeId from DependencyNodeBase where BaseSolutionId=@solutionId

--alter table DependencyBase NOCHECK CONSTRAINT dependencynode_ancestor_dependency 
--delete from DependencyNodeBase where BaseSolutionId=@solutionId
--alter table DependencyBase CHECK CONSTRAINT dependencynode_ancestor_dependency
--print 'removed dependencies'

declare @tables table (id int identity, name nvarchar(100), ismanaged bit, issolution bit)
declare @count int, @currentTable nvarchar(100), @currentM bit, @currentS bit, @sql nvarchar(max)

-- go through all the tables that have the ismanaged/solutionid flag, find the related records for the current solution and move them to the crm active solution.
insert into @tables (name, ismanaged, issolution)
	select name, 1, 0 from sysobjects where id in 
		(select id from syscolumns where name in ('IsManaged')) 
	and type='U'
	order by name
insert into @tables (name, ismanaged, issolution)
	select name, 0, 1 from sysobjects where id in 
		(select id from syscolumns where name in ('SolutionId')) 
	and type='U' and name not in ('SolutionComponentBase') -- ignore this table because it doesn't make a difference. it does cause dependency errors on the exported solution but we can manually edit the xml for that.
	order by name
select @count = count(*) from @tables
while (@count > 0)
	select @currentTable =name, @currentM =ismanaged, @currentS =issolution from @tables where id=@count
	if (@currentM = 1) 
		select @sql ='update ' + @currentTable + ' set IsManaged=0 where SolutionId=N''' + cast(@solutionId as nvarchar(100)) + ''''
		exec (@sql)
		print 'updated IsManaged to 0 on: ' + @currentTable
	if (@currentS = 1)
		select @sql ='update ' + @currentTable + ' set SolutionId=N''' + cast(@systemSolutionId as nvarchar(100)) + ''' where SolutionId=N''' + cast(@solutionId as nvarchar(100)) + ''''
		exec (@sql)
		print 'updated SolutionId on: ' + @currentTable
	select @count = @count -1, @currentTable = NULL

4. It will show some errors after running the script. I ignored them.

5. Now go into Settings > Customizations > Solutions > and export the solution as Unmanaged. Notice that it has become Unmanaged from managed now.

6. Save the zip file and extract it to a folder

7. Open the solution.xml file from the folder and search MissingDependency tag.

8. You will notice lot of MissingDependency elements, remove them all and self close the MissingDependency tag like this <MissingDependency />

9. Zip the files again and now import it to your development environment. Now you can import it as managed or unmanaged wherever you want.

Cheers! :)

Microsoft Dynamics – the needs of the customers and partners match

Continuing from our post yesterday, there were some key areas that the survey focused on, both from the perspective of the customers and the partners:

From the perspective of the customer, the areas under consideration included:

  1. Management and ownership of the solution
  2. Six month plans for any new additions to features, capabilities or add ons, or any other investments in the solution
  3. Their sentiment towards their solution partner’s relationship with them

From the perspective of the partner, areas under consideration included:

  1. The needs of the clients in terms of functionality and strategy
  2. The perception that the partners have towards the Dynamics products and their strategic competitive position.
  3. Point of view on deployment strategies
  4. Their own performance towards sale of Dynamics products
  5. Their usage of additional add ons and working with other software vendors or solution providers

The survey results revealed significant emerging trends for the future. One of the key areas of evaluation includes customers responding that they are most likely to consult with their solution provider for Dynamics AX while customers with Dynamics CRM would least likely consult their solution provider.

Another interesting insight which helps to align the goals of both customers and the partners is that both parties are focused on these five functional aspects:

  1. Reporting as well as Business Intelligence
  2. Customer Services
  3. Integration as well as Migration
  4. Business Processes
  5. Inventory Management

Next up, we will discuss the user sentiment that was evaluated during this survey to understand how customers fare in using Microsoft Dynamics products.