Storing the “Last Activity” on a Microsoft Dynamics CRM record

By - September 17, 2015

One of the most common requests in the xRM world (Download our white paper, Extending CRM: Utilizing xRM to expand your relationships, to learn more on this topic.) is to view a list of records along with the last-most activity action against that record.  Interestingly enough, Microsoft Dynamics CRM hasn’t provided an out of the box feature to support this request.

In this blog, we’ll step through a set of customizations to provide this feature.  As always, it’s imperative that we automate as much of these requests as possible.  Giving the end user information that for which they don’t have to work is always a ride in the fast-lane towards user adoption. For this exercise, we’ll ensure that the last most appointment, phone call, task and email activity modified for an opportunity is stored on that opportunity record.

Create three fields on the Opportunity to store the date, subject and a link to the activity.

On the Opportunity entity, create three fields as outlined below.  For the Last Activity field, set the format to URL.

Blogs - Storing the Last Activity on a Record-1

For each of the activity types, create a real-time workflow that fires on edit of activity.

For our example, we’ll create a workflow against the Task entity.  These steps can be replicated for all other activities.

  1. Create a new workflow against the Task entity.
  2. Once created, click the “Convert to a real-time workflow” button at the top.
  3. Click the “Record is created” checkbox.
  4. Click the “Record fields change” checkbox, then click “Select” and select all fields.
  5. Click “Save” to save your changes.

Blogs - Storing the Last Activity on a Record-2

Update the related Opportunity with fields from the activity

We need to ensure this workflow continues only when the activity is created against an opportunity.

  1. Click Add Step, Check Condition.
  2. From the query window, select Regarding (Opportunity) -> Opportunity -> Contains Data
  3. Click Save and Close

Blogs - Storing the Last Activity on a Record-3

Now set the appropriate fields on the Opportunity record.

  1. Click Add Step, Update Record
  2. Select Regarding (Opportunity)
  3. Click Set Properties
  4. Update the respective Last Activity fields from the related task fields using the Form Assistant.
  5. For the Last Activity field, select the Record URL(Dynamic)(Task) dynamic value.
  6. Click Save and Close

Blogs - Storing the Last Activity on a Record-4

Display the Last Activity fields on the form or in a view.

The Last Activity fields can be placed on the form or added to a view.  For the form, ensure the fields are wide enough to display the necessary text.

Adding the fields to a view allows for a snapshot view of any opportunity and the last-most activity.  The user can easily sort by the Last Activity Date to see opportunities with little activity.  With the addition of the Record URL for the last most activity, the user can open the related activity right from this view by clicking the URL.

Blogs - Storing the Last Activity on a Record-5

Note that the Last Activity Date can also be used with additional workflows to send an alert (email) if an Opportunity becomes stale.  We’ll leave this additional workflow as an exercise for the user.

RSM offers customized training as well as other services for Microsoft Dynamics. If you are interested in assistance with conducting a Microsoft Dynamics CRM training or implementation, please contact our professionals for more information on our services at 855.437.7202 or If you like these tips, you may consider subscribing to our Dynamics Community News publication.

By: Valter Herman – Colorado Microsoft Dynamics CRM partner

Receive Posts by Email

Subscribe and receive notifications of new posts by email.