This is going to be a follow up for the original post, so, if you have not read it, you might want to do it first:

Team Work: Is somebody else working with the same record?

In this post, I wanted to explain how that solution actually works since, it seems, that’s what was missing there.

Basically, the idea is that there is a special “Action Tracker” entity in that solution where record actions can be reported:

image

With that entity in place all that’s required is a bit of development to make the notifications work.

1. We need to add a javascript web resource to all the forms that we want to enable notifications for. Here is what it’ll be doing:

image

And that’s “Action Tracking” web resource in the Team Work solution.

It’s a “smart” web resource that does not require an “onload” event handler to be configured. It’ll just wait till Xrm has been initialized, and, once it’s there, it’ll start doing what it is supposed to be doing.

When verifying existing action trackers, it will check for all action tracker for the current record that have Action set to “Open”, and that were created by other users.

If there are any, it will display a notification.

On the other hand, it will also be creating new action trackers every 60 seconds just to let others know that this particular record has been opened by the current user.

2.  We need to implement some cleanup process so that those action trackers that are no longer needed do not get stuck there forever

That’s what “Team Work: Delete (Open) Action Tracker” workflow is for:

image

It’ll start on create of an action tracker and will set “delete” attribute of that action tracker to “yes” in 2 minutes:

image

3. And, finally, we need a plugin to actually delete the action tracker when its “delete” attribute has been set to “yes”

That’s what DeleteRecordPlugin is for:

image

As for #3, it could be implemented as a custom workflow activity as well. However, I think there are, already, lots of workflow activities in Dynamics.. the way I see it, there is no real need to pollute workflow designer with yet another one.

Either way, feel free to download the source codes etc directly from GitHub. If I missed anything above, you’ll find all the details there:

https://github.com/ashlega/TeamWork