What is a grouped Activities
Grouped Activities are sequences of activities that can be reused in multiple processes and ZP services. They act as an isolated part of the process workflow, containing their own variables and activities, and taking input and output parameters that are assigned to variables used by the different activities within the grouped activity. A grouped activity can contain all the different built-in activities except Approval and Task as well as provider activities.
Creating a grouped activity
In this guide we will create a grouped activity that takes a computer name as input and returns the owner and the owners manager. To create a grouped activity we select the new Grouped Activities menu item in the Administration Web and then click Add Activity.
On the General tab we enter an identifier, a name and a description for the grouped activity. We also select a category. The new grouped activity will be available in the Activities menu of the process/service Workflow Editor under the Computer utilities category.
Now we create the variables and workflow just as we would with a shared process (we won't actually create the workflow in this guide, but for demonstration purposes we create three string variables named ComputerName, Owner and OwnersManager). When creating the variables, note that you can specify them as input and/or output parameters. It's not necessary at this point as we can define the parameters separately later on.
When we're done creating the variables and the workflow, it's time to define the input and output parameters for the grouped activity. To create a parameter we go to the Parameters tab, then click the Create new parameter button.
This will bring up the Edit parameter dialog with a variable already selected, in this case ComputerName (we can use the Variable dropdown to select another variable). We want to use the ComputerName variable as an input parameter, but we also want to make it a required parameter (the workflow won't really work without it) so we check the Required parameter box. We also change the display name to Computer name (looks nicer than ComputerName) and add a description as well.
Our grouped activity is designed to take a computer samaccountname as input and return the samaccountname of the owner and of the owners manager . Therefor we need to define two output parameters so that the owner and owners manager information can be accessed in the containing process. In this grouped activity this information is stored in the two variables named Owner and OwnersManager. So we click the Create new parameter button again and select the Owner variable, set a display name and a description, and uncheck the Use as input parameter box (this will automatically check the Use as output parameter box instead).
We do this one more time to define the OwnersManager variable as an output parameter, and then save the activity.
Using a grouped activity in a shared process
Using a shared activity in a shared process or standalone service is much like using a provider activity. In the workflow editor of the process, the grouped activities are listed alongside built-in and provider activities under Activities on the right side of the workflow designer. Here we have created a new shared process and dragged the Get computer owner and manager grouped activity into the workflow designer. The activity header's red background indicates that we have not yet provided all of the required parameters. Notice the parameter names and descriptions that we entered when we created the parameters.
Just as with a provider activity, we can specify static values or variables for the input parameters (or leave them not set if they are not required). Output parameters can only be bound to variables (obviously), or we can leave them not set if we're not interested in the information.
Updating a grouped activity
Unlike a shared process, when a grouped activity is updated it doesn't immediately affect the processes that use the grouped activity. The processes will continue to use the previous version until they are manually updated. Updating a process to use the latest version of a grouped activity can be done in two ways. The first way is to update from within the process itself. The second way is pushing the new version to the linked processes from within the grouped activity.
Updating from within the linked process
The picture below shows a process that contains a grouped activity that is not the latest version. Notice the yellow background and the text indicating that a newer version is available. To update to the latest version just click the Update to latest version button.
Pushing the updated grouped activity to linked processes
When a grouped activity is used in many processes it may not be practical to update the activity from within each process. Instead you can choose to push the update to the linked processes from within the grouped activity itself. To do this, open the grouped activity and select the Linked processes tab. Here you will see a list of shared processes and standalone services that use the activity. In the picture below the activity is only used in one process. Notice the warning icon indicating that the process is using an old version of the activity. Also notice the number in the Activity version column telling you what version (or versions) of the activity is used in the process (the current version number is displayed under the General tab). To update the process, select it using the checkbox next to it and click the Update selected processes button.
You will get a warning message about the risks of updating published processes along with a Continue button and a Create draft(s) button. If you click the Create drafts(s) button the updated process will be saved as a draft version which you can test before pushing the update to the published process. If you click Continue the updated grouped activity is pushed to the published process.
After updating an icon indicates if the update succeeded or not, and the Activity version is updated to the current version number.
The push method is not possible if you have added or changed a required parameter in the grouped activity as that would definitely stop the process from working.