Posts tagged with: Microsoft Dynamics CRM

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'

-- DO NOT TOUCH FROM HERE ON --
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)
begin
	select @currentTable =name, @currentM =ismanaged, @currentS =issolution from @tables where id=@count
	
	if (@currentM = 1) 
	begin
		select @sql ='update ' + @currentTable + ' set IsManaged=0 where SolutionId=N''' + cast(@solutionId as nvarchar(100)) + ''''
		exec (@sql)
		
		print 'updated IsManaged to 0 on: ' + @currentTable
	end
	
	if (@currentS = 1)
	begin
		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
	end
	
	select @count = @count -1, @currentTable = NULL
end

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 – research on the needs and attitudes

An independent survey was conducted by MS Dynamics World to evaluate various needs and attitudes towards MS Dynamics products (ERP and CRM) by both customers and partners. The survey conducted between 640 participants indicated a range of responses, and helped evaluate the trend in popularity of capabilities, sentiment analysis between customer and partner relationships, and challenges that customers face in their implementation and operations of MS Dynamics products.

Several aspects were revealed with respect to the three elements under study, popularity of capabilities, sentiment of customers and challenges that are faced:

  1. Respondents felt that they were not able to utilize their Microsoft solution to the fullest extent. Full or good utilization was marked by only 23% respondents.
  2. On the same lines, 22% customers indicated that they would like to spend money in the next six months to improve their Microsoft solution.
  3. The main areas that most partners and customers were primarily interested in, include: Reporting and Business Intelligence, Migration, Integration and Business Processes
  4. Most respondents felt that that Microsoft Dynamics ERP and CRM will and have shown positive progress in their respective markets.