Cloud and Datacenter Management by Anders Bengtsson

Add a new activity to a existing service request

A couple of weeks ago I was working on a scenario were we needed to add a review activity to a service request with Orchestrator. Part of the solution for that scenario were a couple of runbooks that I want to share in this blog post. These runbooks adds a new review activity to a existing service request. All runbooks require a input parameter when it starts, the service request ID. These runbooks set the domain admins group as reviewers in the new review activity.

When adding a new activity to for example a service request it is always added as the first activity. If there are already two activities the new activity is added before them, in other words the new activity is the one that will run first. You can control this by working with the sequence ID parameter. The first activity have value 0 and the second have value 1 and so on. If two activities have the same value they will run at the same time. You can update activities already existing in the service request and insert the new activity in any order you need, as the 70.2 runbook do.

This example is built on three runbooks.

  • 70.1. This runbook adds a new review activity to a existing service request. The new review activity is added as the first activity (sequence ID equals 0) and the Domain Admins security group is set as reviewers.
  • 70.2. This runbook is used to update current activities with a new sequence ID. The runbook simple add one (+1) to each sequence ID value. This is because in the example we want to add the new activity as the first activity, as we add one to each existing activity there will no longer be a activity with sequence id equals 0. We can then create the new activity and add it with sequence id equals 0.
  • 70.3. This runbook is used to get current activities and each sequence ID. The result is written as platform events. This runbook is not really needed but it is nice to have to see the current configuration
We should 70.2 first and then 70.1.


The result is that a new review activity is created in the service request. Domain Admins are set as reviewers on the new review activity.

You can download my example runbooks here, 20120730_addActivity_Sanitize , please note that this is provided “as is” with no warranties at all.

In this blog post I show how activities in a service request can be updated by a runbook activity, for example dynamic approval steps.

« »

© 2019 www.contoso.se. Theme by Anders Norén.