# How do I notify team members of a potential action to-do if they are not assigned to the action?

**URL:** https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383
**Category:** Process Design
**Created:** [January 28, 2012, 3:10am UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383 "2012-01-28T03:10:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![wfg-admin](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/wfg-admin/32/714_2.png) [@wfg-admin](https://discuss.workflowgen.com/u/wfg-admin)
#### Post date: [January 28, 2012, 3:10am UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/1 "2012-01-28T03:10:20Z")

</div>

### Issue

How do I notify team members of a potential action to-do if they are not assigned to the action?

### Background

Since a WorkflowGen action can only be assigned to one user at a time, there are options to automatically target the assigned user when sending out a notification. When configuring an additional action notification you can do this by selecting the **Action assignee** recipient option. No matter which selected event is used when configuring an additional notification, selecting **Action assignee** will always target the current assigned user.

### Solution

In some cases an action is not assigned to a specific user but is instead to be handled by a team using the Self-Service assignment method. In this case, even though the action is technically not assigned to a user, WorkflowGen will automatically interpret the **Action assignee** recipient option to mean all team members, and therefore all team members will receive the email\*.

When sending an **Automatic: To do** email and the action is assigned, the recipient will receive an email with a link to directly launch the action from the email. If the same event (To do) is used when sending an additional notification to a team (with the action not assigned), the team will receive a similar default email, but since the action is not assigned to a user, the link to directly launch the action will not be present.

\*The number of users receiving this email will be limited to the number provided in the **Maximum number of users to notify** setting, under **User notification** on the **Portal** tab in the Configuration Panel.

---

<div class="post-metadata">

### Author: ![marinam](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/marinam/32/322_2.png) [@marinam](https://discuss.workflowgen.com/u/marinam)
#### Post date: [November 19, 2020, 11:35am UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/2 "2020-11-19T11:35:38Z")

</div>

Hi @eddy.daouk,  
Is it possible to send “action closed” notification to Requester Manager, if Manager is not involved in the process? I had idea to map in manager email in the initial form and create data element of it. Unfortunately, only manager information that can be used from “macro list” is first, last name and username.

Thank you  
Marina

---

<div class="post-metadata">

### Author: ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)
#### Post date: [November 26, 2020, 12:16am UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/3 "2020-11-26T00:16:41Z")

</div>

Hi @marinam,

You can use a query similar to the following post to retrieve the Manager’s email:

> [@How to Retrieve First name and Last name of Manager?](https://discuss.workflowgen.com/t/how-to-retrieve-first-name-and-last-name-of-manager/895/4):
>
> Hi David, You can use the following code as an example : string lastname; string firstname; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MainDbSource"].ToString(); string queryString = "SELECT [LASTNAME],[FIRSTNAME] FROM [USERS] WHERE USERNAME = '" + USERNAME + "'"; using(System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connectionString)) { System.Data.SqlClient.SqlCommand command =…

Instead of `SELECT [LASTNAME],[FIRSTNAME]` put `SELECT [EMAIL]`

Eddy.

---

<div class="post-metadata">

### Author: ![marinam](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/marinam/32/322_2.png) [@marinam](https://discuss.workflowgen.com/u/marinam)
#### Post date: [December 1, 2020, 12:18pm UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/4 "2020-12-01T12:18:09Z")

</div>

Hi @eddy.daouk,  
I implemented the code you listed above and changed firstname, lastname to email.  
But now I am receiving the following error:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/workflowgen/original/1X/a12ba202d85c36373608b557d6ebf230d996a86d.png)  
Could you please help me with this?  
Thank you,  
Marina

---

<div class="post-metadata">

### Author: ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)
#### Post date: [December 6, 2020, 3:08am UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/5 "2020-12-06T03:08:00Z")

</div>

Hi @marinam,

The code needs to be inside of a method (for example inside the PageLoad() method)  
From what I’m seeing this code is put on the class level which is not supported in C#.

Regards,  
Eddy.

---

<div class="post-metadata">

### Author: ![marinam](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/marinam/32/322_2.png) [@marinam](https://discuss.workflowgen.com/u/marinam)
#### Post date: [December 13, 2020, 5:17pm UTC](https://discuss.workflowgen.com/t/how-do-i-notify-team-members-of-a-potential-action-to-do-if-they-are-not-assigned-to-the-action/383/6 "2020-12-13T17:17:12Z")

</div>

@eddy.daouk Sorry for following up on this question multiple times. Unfortunately, we do not have any Dev type resources in our team, so it is really hard to follow those code instructions. This is what we have at this moment:

```
    string email;
    string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["MainDbSource"].ToString();
string queryString = "SELECT [EMAIL], FROM [USERS] WHERE USERNAME = '" + USERNAME + "'";

```

using(System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connectionString))  
{  
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(queryString, sqlConnection);  
sqlConnection.Open();  
using (System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader())  
{  
while (reader.Read()){  
email = reader.GetString(0);  
}  
}

How should I update the code to refer to PageLoad method? Thank you a lot!
