How To Reopen Closed Activities in Microsoft Dynamics CRM 2013 with Bookmarklet

Paul Nieuwelaar, 18 November 2014

In Microsoft Dynamics CRM, once an activity has been closed, unlike most other entities, there’s no button to reactivate it. This means that if an activity is accidently closed, or if we want to modify some fields after it’s closed, we simply cannot. One way to reactivate the activity is to create an on-demand workflow. This works well, however if a user doesn’t have permissions to create workflows, and one doesn’t already exist, then they cannot do this.

How To Reopen Closed Activities in CRM 2013 with Bookmarklet

I have looked at the code behind the standard ‘activate’ button, and have found that the same code works on activities as well, we just need to trigger it somehow. We can either create a custom button on the command bar for each activity entity so any user can use it, or if you just want a quick solution for yourself you can create a browser bookmarklet, or run it straight from the URL.

The code to use for a bookmarklet, or to paste directly into the URL bar is as follows (make sure to re-add the ‘javascript:’ part as most browsers strip this out):

javascript: var form = $("iframe").filter(function () { return ($(this).css('visibility') == 'visible') })[0].contentWindow;form.Mscrm.CommandBarActions.activate(form.Xrm.Page.data.entity.getId(), form.Xrm.Page.data.entity.getEntityName());

How To Reopen Closed Activities in CRM 2013 with Bookmarklet

Or if you’re going to create a command bar button, the code for the action should just be:

Mscrm.CommandBarActions.activate(Xrm.Page.data.entity.getId(), Xrm.Page.data.entity.getEntityName());

This button can work on any entity, but since most entities already have an activate button, it is mostly only useful on activities. When clicked, it will simply fire the CRM Activate logic to set the activity to Open.

How To Reopen Closed Activities in CRM 2013 with Bookmarklet