We recently ran into a customer requirement for the ability to schedule weekly recurring service activities in Dynamics CRM 4.0. We realized that this new functionality could be quite useful for companies that schedule regularly recurring activities with their customers. A range of businesses from physical therapy to facility maintenance might be able to take advantage of such a feature.
The solution that we delivered used JavaScript built into the Service Activity entity form, that will determine if a given Service Activity is to be repeated and for how long. It will then call web services to create the resulting Activities. For those interested, here are the steps required to implement this feature.
Create Custom Attributes
Two customer attributes were created to determine if a Service Activity should be repeated and for how long:
-
new_recurringactivity – bit attribute type
-
new_recurringenddate – datetime attribute type
We then added these two fields to the Service Activity form as shown.
Add Form-based JavaScript
Next two pieces of JavaScript were created and loaded onto the Service Activity form.
The first, which is triggered off the OnSave event, checks to see if the current activity has been marked as recurring and also saves the end date of the recurring services. The script then calls the CRM web service to create multiple Activities with the same parameters as the original.
The second piece of JavaScript, that runs OnLoad, checks to see if the Service Activity is already part of a recurring series, and if so, disables the recurring detail controls.
Anyone interested in the actual JavaScript code can download the file from this link.

#1 by Cwb on October 13th, 2009
I have a couple questions. How do I go about adding the code to CRM. Do I need to export the service activity customizations .xml add the code and import it back in? Or am I going down the wrong path here?
#2 by Cory Fellers on October 13th, 2009
Javascript code such as this can be applied to entities in CRM using the customization interface. From your homepage navigate to Settings -> Customization -> Customize Entities -> Service Activity -> Forms and Views -> Form. From there open the Form Properties window. Inside the javascript file I provided are two segments of code. One of them should be inserted into the OnLoad event of the form and the other into the OnSave event of the form.
Let me know if you run into any trouble.
#3 by Kyriacos Kyriacou on December 13th, 2009
Hi ,
I have tried to add this js to crm 4 in order to have recurring service activities but is just not working , it shows me errors on both load and save of a service activity …
Any advise ?
#4 by Cory Fellers on December 16th, 2009
First verify that you created the custom attributes with the exact same names as those referenced in the javascript.
If that is not the issue, let me know what errors it is firing on the OnLoad and OnSave.
#5 by Deniz on December 18th, 2009
Dear Cory, great contribution, thanks a lot.
#6 by Wendell Dudley on May 28th, 2010
I am trying to access the http://www.systematicainc.com/Blog/RecurringServiceActivity.js to take a look at it but only what looks like your sitemap