Scenario: A company plans to shut down some of its servers during the holidays. Most employees are out of the office, but the few who are working need to know when the servers will be unavailable. A workflow process notifies only working employees of the server shutdown.
A custom component begins the process by retrieving employee (user) information from a company database. This component returns an array variable called AllUserInfo of data type UserInfo. This variable contains all basic information (including email address) on every employee in the company. An Add Items to Collection component creates a collection called AllUserInfoCollection.
Another custom component then retrieves user information (including email addresses) for all employees registered for vacation over the holidays. This component returns an array variable called EmployeesOnVacation of data type UserInfo. A Remove Items from Collection component then removes these items from the collection called AllUserInfoCollection.
During run-time, this component removes the user information for all employees on vacation from the collection AllUserInfoCollection. When this happens, the collection contains user information only for employees not on vacation - employees who are in the office. These are the employees who need to get the notification email about when the servers will be down.
Next, a For Each Element in Collection component hands user information one at a time to the Send Email component. This is necessary because the Send Email component can only send one email at a time. The For Each Element in Collection component creates an automatic variable that contains a single value (array or single) from the collection. You can rename this automatic variable; we named ours OneEmployeeOnVacation.
Other components in this example are as follows: