How do I safely add an attribute to an Opportunity? - dynamics-crm-2011

I am building a plugin that utilizes the new Business Process Flow in Dynamics 2013, and in order to take full advantage of the easy to use check-list style menu I have added two new attributes to the default Opportunity entity in Dynamics CRM.
I have done this in the plugin's customizations.xml file by adding the attributes to the Opportunity Entity under the EntityInfo->Entity->Attributes section of the Entity xml.
The addition of this field to the Opportunity works just as expected, though I am running into issues when uninstalling the plugin.
Since this plugin will be widely available, I can't expect users to keep it on their systems forever.
On uninstallation of the plugin, however, Opportunities can no longer be viewed in the CRM 2013 Online. When I try to view one I get the following:
Critical
Query Builder Error
The specified field does not exist in Microsoft Dynamics CRM
Is there something I can do within the customizations.xml file to ensure that once the plugin solution has been uninstalled, Dynamics CRM will no longer reference these fields?
note: This issue occurs on a brand new instance of Dynamics CRM 2013 (trial) with the plugin simply installed / uninstalled, so no other customizations are linking to changes from the plugin and causing the crash

If you were to make this change via the UI, it would block you from deleting these fields until all dependencies have been removed as well. Because you chose to do this without the assistance of the UI, it is breaking on you. If you go back and make this change via the UI, the customizations.xml file should be properly updated and you should be good to go (or it will error and say where there is still a dependency - making it easy to go and fix it).

Related

How can I identify missing features in a SharePoint site that has been restored from a different farm?

I recently inherited an application from a developer who is no longer with the company. This application restores SharePoint sites from backups and extracts metadata and files from lists in the site. The application runs on a SharePoint server and uses the Microsoft.SharePoint assemblies in C# and VB.Net.
The backups come to us from various outside companies, and some of them have custom features installed. SharePoint Health Analyzer shows a warning about "Missing server side dependencies". When I look at the report there is a lot of "[MissingFeature] Database [db name] has reference(s) to a missing feature..." etc. The previous developer was supposed to implement a check for missing features, but it is obviously not working.
How can I identify features that the restored site references, but are not installed on the farm?
Thanks!
RH
You can use SQL Management Studion and check Features and FeatureTracking tables to see list of features, its' IDs, titles etc.
But do not modify these tables.
To solve missing features error. You can:
1. install missing feature (if you have it).
2. try to remove it (probably will fail as you don't have it).
3. as the last chance option you can create empty feature with the same ID as missing feature, pack it in WSP package and install it.

How to copy Notes and Activities while converting Contact to Lead in Microsoft Dynamics CRM 2011

I have a requirement to copy all Notes and Activities while converting Lead to Contact and vice versa.
When I Qualifying Lead to Contact I use my custom plugin which is triggered by QualifyLead event. There is no out of the box solution to convert Contact to Lead so I use my custom on-demand dialog. But this dialog unable to run my custom plugin (which will copy Notes and Activities from Contact to Lead).
Please help me to find a way to copy all this stuff from Contact to Lead.
You can create a Custom Workflow Activity with the code of your custom plugin and uses as step inside your on-demand dialog.
You can start from here:
http://msdn.microsoft.com/en-us/library/gg328515.aspx
Another way that you can do this is to simply reference the notes from the Lead in the Contact, Account, or Opportunity entities using an IFrame and some JavaScript as described in http://030bacf.netsolhost.com/WordPress/?cat=69 . Depending on how many records you have, potentially this could even be a better solution since you are only keeping one copy of the notes which will help keep the size of the database more manageable and performance better. Or you could use this solution for the notes and the solution recommended by Guido for the Activity records. I had to make a change to the URL used for CRM 2013 and have copied that part below.
//src="/"+context.getContext().getOrgUniqueName()+"/_controls/note/notesdata.aspx?id="+lookupItem[0].id+"&ParentEntity=3&EnableInlineEdit=false&EnableInsert=false";
// change to this for CRM 2013
src=serverUrl+"/"+Xrm.Page.context.prependOrgName("/_controls/notes/notesdata.aspx?id="+lookupItem[0].id+"&ParentEntity=3&EnableInlineEdit=false&EnableInsert=false");

Publish/Version history for forms in Dynamics CRM 2011

Is there any way to determine which user and when that last changed or published a form in Dynamics CRM 2011?
I've looked everywhere that I can think of, from the form itself to auditing, customizations in the default solution, system settings and I can't find anything anywhere.
If it isn't turned on by default, how do I turn on auditing on the framework itself instead of the content so we can know next time something strange happens?
There isn't a built-in log or audit for the customization changes.
You can try to build your own with plugins attached to the Publish and PublishAll messages

Plugin missing from organisation

Dynamics CRM 2011 on premise.
We have had a plugin registered for a few months. It was referenced by a solutions in two organisations and I could see it in Solution > Components > Plug-in Assemblies in each organisation.
Yesterday I noticed it was not visible in this view. The Plugin Registration Tool shows it still installed.
I unregistered it using the Plugin Registration Tool and then registered it again but it still isn't visible in the solution that references it in either organisation.
We get a "Could not load file or assembly" exception when the plugin is called.
How can I investigate this?
Registering a plugin doesn't put it in a solution. You'll have to add it back manually to whatever solution(s) you want.
Go to Customizations > Solutions > Open your solution you want the plugin added > Plug-in Assembly > Add Existing. If the dll doesn't show up there, you either didn't register it at all, or registered it for a different org
Go to Customization > Customize the System > Plug-in Assemblies
When you deployed, it might be installed in default solution. You can always add it back to your Solution as #Daryl said.
Ok, I'm not sure why, but it seems to be working again.
I removed all trace of the plugin from both servers and from the orgs and solutions and then added it back and now it seems to be ok.
Is annoying because I don't think I learnt anything and it used a lot of time.
Thanks for your help.

crm 2011 making changes to a managed solution entity

we are currently working on a specific CRM development. As part of this development we are working with a different supplier who have provided us with a 'core' managed solution, a toolkit of sorts. This toolkit contains a number of entities/web resources etc but crucially contains the case and contact (renamed to customer) entities. As part of our development we need to extend these entities by adding attributes/amending form layout etc for both these entities.
should i create a new unmanaged solution - select add existing - choose the customer entity.
I can then make my changes (new attributes, form layout changes etc)
I then publish my unmanaged solution as a managed solution to import into a UAT/Prod environment.
Would this approach work ok?
What if the supplier make changes to their core entity and provide us with an updated release? what happens then or what should i do?
There are a couple of attributes (title and ethnicity) that are part of their entity but i need to work of global option sets so i have create 2 new attributes and these are displayed on the form in place of their's. I have not removed theirs but could this cause issues?
any help appreciated
chris
You are right on in the first paragraph, you would need to create a new solution and amend their entities. When you import their changes it will add on any additions to those entities. Importing customizations should never remove anything, you have to do that manually. Although unlikely, it is possible that the vendor may release a new version that requires you to roll back your customizations and reinstall it. In this instance you would need to come up with an upgrade plan and take into account all of the dependencies of the system.
I would imagine that those attributes would be dependencies of their managed solution and suspect that CRM won't let you delete them. If you are able to delete the fields and recreate them using global option sets there should be no issues so long as you use the same picklist integer values and schema names for the fields. Microsoft CRM basically copies all of the global option set values to the entity that you put them on so externally there is no difference between the standard and global option sets. Obviously a future upgrade by the vendor may force you to delete it all and recreate everything again manually (or via code using the CRM web services), but that is something you would have to take into account.
What the disadvantage here is, is if you create an entity, attribute or relationship in Dev and deploy to forward facing entity, if you then remove that entity, attribute or relationship in Dev, you must "uninstall" that solution. Of course, if you have critical data in that forward facing environment, it is gone when that solution is removed. So, if you deploy from Dev to forward facing, if in the future you no longer need that entity, attribute or relationship, although you can remove it from forms, it will always remain an artifact in your system. This is a disadvantage when working with Managed solutions.

Resources