Written by Marek Popkowicz
Published April 6, 2016

How to share activities in workflows in CRM 2013

In this article, we describe how to manage security access to activities created in workflows in Microsoft Dynamics CRM 2013. We also show how we use the activitypointer as a universal activity type parameter in workflow custom code activity.

Security challengeCRM collage3

Microsoft CRM 2013 has quite good security system based on security roles and teams. But….

There is always some but. That type of security system is good if:

  • We do not have confidential information stored in CRM in those standard entities that are used by all users
  • We do not have a lot of collaboration between users from different business units (BU) inside CRM

But, what if :

  • We have crucial information stored in common use entities (e.g. activities)
  • We have a lot of processes where there is interaction between users from many BU

In theory, a user can manually share records with other users but in real life, no one wants to do that.

Business challenge

In our CRM, we have some confidential information stored in activities (it was very hard to store that information in other entities because there are related directly with activity). Because of that, a typical user (in our case sales rep) can see just his or her activities and activities related to his / her customers (To do that we created a special plugin to share specified entities based on some business logic).

Activates access vs Processes automation

The problem appeared when we started to use workflows where sales rep was creating approval tasks for other users (If we want to create a task or any activity for other users, we need to have a write and read permission to that activity).

How did we solve the problem?

We created a custom activity to share activities inside workflows. By using this custom activity we are able to give any type of permission to any activity created in the workflow.

How does it work?

1. First, we need to create activity and we need to assign it to process owner (in our case it was the case owner).

2. Then we share that activity with process owner by using sharing a custom activity (we need to do that if we want assign activity to someone else).

3. Next step is changing the owner of the activity to required user.


As a result, we get activity with all needed permissions for the owner of the activity and the owner of the process.

Some of you can say that we can get a similar function by using real-time workflows, but in our case we use Wait conditions in WF, and this is something that we cannot use in Real-time WF.

Custom activity sharing challenge

When we create custom activity we need to set specific parameters

In this case, we need to send information:

  • Who should have access to activity
  • What type of access should be given that user or team
  • What type of activity

If you check how many activity and permission types we have in CRM, you will notice that in order to handle all possible variations, you need more than 40 parameters.

To simplify that, we tried to use the activitypointer as a universal activity type parameter.

From the code side, that solution works very well and it is compatible with CRM SDK.



As a result, we should get custom activity:


One more challenge – Workflow designer does not see the activitypointer value!

Workflow designer is not able to show relations if we do not specify the type of activities (it is probably a bug of CRM 2013 or a missing functionality).


crm 3

How to do some magic 🙂

To resolve that problem we need to use browser developer tools and update that parameter manually

1. Open browser developer tools (in Chrome F12)
2. Select valueselector field

crm 4

3. Edit section in html mode

crm 5

4. Paste Value <option title=”Task” value=”task.CreateStep1.task.activityid”>Task</option> – it is ID of WF element that we need to set as the parameter (You need to adjust it base on CRM syntax).


5. If we do this correctly, the WF window should look like:

crm 6

6. Accept the new value. It should be visible in Activity identifier value field:

crm 7

All done 🙂


It is not the cleanest solution but it works and does not generate any errors.

If you have any questions do not hesitate to ask.

CRM collage2Marek Popkowicz is a Microsoft CRM Specialist working in the FINN CRM team at Schibsted Tech Polska. The team located in Krakow works with the Microsoft Dynamics CRM 2013/2016, Microsoft ASP.Net MVC 4/5 and Microsoft SSIS technologies.




Written by Marek Popkowicz
Published April 6, 2016