0
votes

I have a requirement to total the durations of all activities related to a custom entity. I have created a custom entity that allows the user to add activities for that instance of the custom entity. Every time an activity is added to the custom entity I need to total the duration and update the custom entity. I started by creating a plugin for an activity. The problem is the only messages you can create the plugin for is retrieve and retrivemultiple. I then went to service activity to create the plugin and I cold create it using the create message.

My question is, is every activity a service activity? Has anyone done this and do you have any tips on the best way to go about it?

Thanks, Gary

1
Wait, why is the only message you can create a retrieve and retrievemultiple?Daryl
That is for the Activity entity. I have access to all the messages in the Phone Call, Email, Appointment, etc. entities. When I first looked at it I was hoping I could just use a single entity.Gary

1 Answers

0
votes

It sounds like you are looking for a plugin or custom workflow that operates on the “parent” entity (the entity the activities are related to.) You would write your code to use the RetrieveMultiple method and then loop through the result totaling the value as you go.

IOrganizationService.RetrieveMultiple Method
http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.iorganizationservice.retrievemultiple.aspx

Rolling Up Custom Entities in Microsoft CRM 2011 and CRM Online
http://www.catapulterp.com/rolling-up-custom-entities-in-microsoftcrm-2011-and-crm-online/