Tuesday, 29 October 2013

Dynamics CRM 2013 - Custom Activity Issue

UPDATE: As of right now (01/04/2014) we still have this issue with many of our clients. Microsoft has requested that we create a ticket to fix everyone individually which I think is a bit ridiculous! So currently this issue has NOT been fixed :-(

With the upgrade of CRM 2011 to CRM 2013 the navigation didn't really suit what we wanted so we looked at doing an immediate update to improve the user experience.

We found by creating custom areas we could split our entities into a more usable style and by replacing some of our JavaScript with business rules meant we could provide a better experience to users on mobile. Where we did have issues though was with custom activities.

The upgrade to CRM 2013 appears to have a few bugs where custom activities are concerned. When a custom activity is created a field called "leftvoicemail" which is a Two Option type.
In CRM 2011 it looks like this
Dynamics CRM 2011 - Custom Activity


In CRM 2013 it looks like this

Dynamics CRM 2013 - Custom Activity

As you can see the field changes from "Managed" to "Unmanaged". This causes an error when you do an import as the following error is created:
"A managed solution cannot overwrite the OptionSet component with Id=xxxx-xxx-xxx-xxx-xxxx which has an unmanaged base instance.  The most likely scenario for this error is that an unmanaged solution has installed a new unmanaged OptionSet component on the target system, and now a managed solution from the same publisher is trying to install that same OptionSet component as managed.  This will cause an invalid layering of solutions on the target system and is not allowed."

To make matters worse you cannot delete this field as you will receive the error "Only custom fields can be deleted."

The only work around I found for this was to manually remove this field from the customizations.xml file.
For each custom activity in your solution you will need to find the following:
<attribute PhysicalName="LeftVoiceMail">

Delete everything including the above line and down to the matching </attribute> tag.


Another issue we had was with a relationship called <<custom entity name>>_mailbox_sendermailboxid. This occurred for each of the custom entities as well and again we had to remove this from the customizations.xml file.

Everything from <EntityRelationship Name="ixa_feedback_mailbox_sendermailboxid"> to </EntityRelationship>.

We have lodged a ticket with Microsoft in the hope they find a resolution as we would prefer not to have to do this hack for every update!


9 comments:

  1. Thanks for posting this Andrew. Very similar problem here (you've saved me some time on my research). Did Microsoft ever propose a solution to this?

    ReplyDelete
  2. We haven't received a response for this issue.

    However there appears to have been a recent CRM Online roll up which has resolved this issue for some of our environments.

    ReplyDelete
  3. Did you ever receive a response from Microsoft on this topic?
    Problem still seems to be present in latest OnPremise versions
    Thanks!

    ReplyDelete
  4. It was fixed on a later roll up of Online.

    I am currently not working with a CRM 2013 On Premise installation so i'm not sure what roll ups are available.

    ReplyDelete
  5. Thanks for posting.

    In our custom activity, we got this error with another TwoOption field which was also wrongly set to Unmanaged, called IsMapiPrivate as well as the LeftVoiceMail one.
    Your workaround saved us a lot of time. Thank you.

    ReplyDelete
  6. Thank you!

    This was very helpful.

    ReplyDelete
  7. Great post! Saved my day..week..

    ReplyDelete
  8. I had the same problem. After migration CRM (On Premise) 2011-> 2013 some of fields from my 2 custom activities were changed from Managed to Unmanaged. What's more I noticed that these attributes were linked to DefaultSolution - not mine. For some time temporary solution (remove these entities from my Solution) was enough but finally the moment when I had to change something in one of these custom activities had come.
    To resolve this bug I crested SQL script which fix metadata in CRM database.
    I hope this fix will be helpful for someone:

    BEGIN TRAN

    BEGIN TRY
    declare @mySolutionId as uniqueidentifier

    set @mySolutionId = (Select SolutionId from [Org_MSCRM].[dbo].[SolutionBase] where UniqueName = 'MySolution')

    UPDATE [Org_MSCRM].[MetadataSchema].[LocalizedLabel] SET
    [IsManaged] = 1,
    [SolutionId] = @mySolutionId
    where [ObjectId] in (SELECT ATTR.[AttributeId]
    FROM [Org_MSCRM].[MetadataSchema].[Attribute] AS ATTR
    inner join [Org_MSCRM].[MetadataSchema].[Entity] AS ENT on ENT.EntityId = ATTR.EntityId
    Where ATTR.Name in ('community', 'deliverylastattemptedon', 'deliveryprioritycode', 'postponeactivityprocessinguntil','processid','senton','stageid')
    and ENT.SolutionId = @mySolutionId
    and ENT.IsActivity = 1
    and ATTR.[IsManaged] = 0)

    UPDATE [Org_MSCRM].[dbo].[DependencyNodeBase] SET
    [BaseSolutionId] = @mySolutionId,
    [TopSolutionId] = @mySolutionId
    where ObjectId in (SELECT ATTR.[AttributeId]
    FROM [Org_MSCRM].[MetadataSchema].[Attribute] AS ATTR
    inner join [Org_MSCRM].[MetadataSchema].[Entity] AS ENT on ENT.EntityId = ATTR.EntityId
    Where ATTR.Name in ('community', 'deliverylastattemptedon', 'deliveryprioritycode', 'postponeactivityprocessinguntil','processid','senton','stageid')
    and ENT.SolutionId = @mySolutionId
    and ENT.IsActivity = 1
    and ATTR.[IsManaged] = 0)

    UPDATE [Org_MSCRM].[MetadataSchema].[Attribute] SET
    [IsManaged] = 1,
    [SolutionId] = @mySolutionId
    where AttributeId in (SELECT ATTR.[AttributeId]
    FROM [Org_MSCRM].[MetadataSchema].[Attribute] AS ATTR
    inner join [Org_MSCRM].[MetadataSchema].[Entity] AS ENT on ENT.EntityId = ATTR.EntityId
    Where ATTR.Name in ('community', 'deliverylastattemptedon', 'deliveryprioritycode', 'postponeactivityprocessinguntil','processid','senton','stageid')
    and ENT.SolutionId = @mySolutionId
    and ENT.IsActivity = 1
    and ATTR.[IsManaged] = 0)

    COMMIT TRAN

    END TRY
    BEGIN CATCH
    ROLLBACK TRAN
    END CATCH

    ReplyDelete
  9. Really helpful stuff regarding crm development, thanks.

    ReplyDelete