Wednesday, January 22, 2014

MS CRM 2013: How to fix ‘sdkmessage With Id = {} Does Not Exist’ error

This error appears when you are trying to import solution that contains plugin(-s) that handle Action(-s) from one environment to other environment:


In Log file and trace file you can find description of error similar to following:
sdkmessage With Id = a79cef5c-dd82-e311-a344-0800272ad985 Does Not Exist

Source of issue is that Ids of SdkMessage

This issue is well-known, registered on Connect but haven’t been fixed yet.

This article describes workaround that will allow to import such solution.

1. Create on source system 2 solutions – first (let’s call it Solution 1) will contain Action(-s), second (let’s call it Solution 2) – plugin(-s) that handle Action(-s) from first solution.

2. Export Solution 1 from source system and import it to target system.

3. Get sdkmessageid for Action(-s) you have imported to target system using following scripts against target CRM DB:

Select SdkMessageId From SdkMessage Where Name = 'Your Action Name'--Like custom_Action

In case you work with CRM Online or you don’t have an access to DB of CRM you can get it using .Net code like:

QueryByAttribute query = new QueryByAttribute("sdkmessage")
{
    ColumnSet = new ColumnSet(false)
};
query.AddAttributeValue("name", "Your Action Name");

Entity sdkmessage = service.RetrieveMultiple(query).Entities.FirstOrDefault();
Guid sdkmessageid = sdkmessage.Id;

4. Export Solution 2 from source system and save it to your PC.

5. Extract all files from Solution 2 and open customizations.xml with notepad or other text editor.

6. Scroll through file, find section that is responsible for registration of steps (SdkMessageProcessingSteps). For each of steps change value inside SdkMessageId node with value that we’ve got on step 3:


7. Save customizations.xml and put it back to Solution 2 archive.

8. Import Solution 2 to target system. Everything should work fine.