I was able to take the procedure outlined by Aaron and modify it to enable Activities instead of Notes. Note – this is completely un-supported by Microsoft. The technique has not caused any problems on my test system, but results may vary. Use at your own risk!
The first step is to create a stored procedure using the following script.
Second, paste the name of your custom entity (where is says “placeEntityNameHere”) in the SQL script below, and execute it. This should create all of the needed system relationships between the custom entity and the Activity entities (Email, Task, etc.).
-- Define the Entity to Update
DECLARE @entityname varchar(64);
SET @entityname = 'placeEntityNameHere';
-- Define a GUID for the relationship
-- This is defined here and passed in so that we can access the relationship later
-- and apply special options if needed
DECLARE @TEMP_RelationshipId uniqueidentifier;
-- Add the ActivityPointer Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'ActivityPointer', '_ActivityPointers', @TEMP_RelationshipId;
-- Add the Appointment Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'Appointment', '_Appointments', @TEMP_RelationshipId;
-- Add the Email Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'Email', '_Emails', @TEMP_RelationshipId;
-- Add the Fax Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'Fax', '_Faxes', @TEMP_RelationshipId;
-- Add the Letter Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'Letter', '_Letters', @TEMP_RelationshipId;
-- Add the PhoneCall Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'PhoneCall', '_PhoneCalls', @TEMP_RelationshipId;
-- Add the ServiceAppointment Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'ServiceAppointment', '_ServiceAppointments', @TEMP_RelationshipId;
-- Add the Task Relationship
SET @TEMP_RelationshipId = NEWID();
EXEC dbo.AddCrmRelationship @entityname, 'Task', '_Tasks', @TEMP_RelationshipId;
go
The final step is to add and delete a new custom entity (or use the app provided at Aaron’s post to handle the update). This step causes CRM to re-process all of its relationships, and forces our manual updates to take affect.
Aaron’s example for Notes also required exporting the entity’s customizations and modifying the XML. This is not required for Activities because no changes are made the entity’s form.
No comments:
Post a Comment