This page describes how to build a simple process that sends an email to each user that is currently logged in.
The process map will need the following variables:
Name | Type | Initial value |
---|---|---|
SessionId | String | N/A |
EmailAddress | String | N/A |
UserFound | Boolean | False |
UserCount | Long | 1 |
Users | Dynamic complex | Column1 is a string |
ResourceId | String | N/A |
Add a node, name it GetSessionId and configure it as a .Net node set to call the ResourceService method GetSession. Set the UserId to a valid user and the LogOnProtocol to 7:
This will also be a .Net node and setup to call GetLoggedOnUsers. The SessionId variable should be mapped to sessionId, the Users variable to the Return Parameter and, by clicking on the Users variable, Column1 should be mapped to the Id field of Resource:
In the configuration map the following variables to the correct fields:
Field | Variable | Description |
---|---|---|
Complex Variable | Users | The variable we are getting the users from |
Start Index | UserCount | The first user in the list; starts at 1 |
Upadated Index | UserCount | Used to keep track of which user we are looking at |
Row found | UserFound | Indicates whether a user was found on this loop around. This variable will be used by the decision node. |
Number of Columns | N/A | Only one column is being used so set this to 1 and click Set columns |
Column1 | ResourceId | After each loop, this will have the user's resource id. This will be used to retrieve the user's email address. |
Next, add a decision node and go to the Condition Text tab in its configuration, drag the UserFound variable into the box and add the text "=true":
Please note that that typing the text will not work; the variable name must be dragged into the box.
This will be an activity node leading from the decision node. It will be configured as a .Net node calling GetResourceEmailAddress, mapping the SessionId, ResourceId and EmailAddress variables as shown:
Add another node and configure it as an email. In its configuration fill out the details and map the EmailAddress variable to the To field:
Once this is done it should redirect to the loop node. This is done by hovering over the EmailUser node so that the cursor appears as a hand and then click and drag onto the loop node.
The decision node needs an end node added to it and its True Path set to GetUserEmailAddress.
Once all the above steps are taken, click the Rearrange button at the top of the screen and the process map should look similar to the following: