{"id":3179,"date":"2012-07-30T22:45:40","date_gmt":"2012-07-30T20:45:40","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3179"},"modified":"2012-07-30T22:45:40","modified_gmt":"2012-07-30T20:45:40","slug":"add-a-new-activity-to-a-existing-service-request","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=3179","title":{"rendered":"Add a new activity to a existing service request"},"content":{"rendered":"<p>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.\u00c2\u00a0All runbooks\u00c2\u00a0require\u00c2\u00a0a input parameter when it starts, the service request ID. These runbooks set the domain admins group as reviewers in the new review activity.<\/p>\n<p>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.<\/p>\n<p>This example is built on three runbooks.<\/p>\n<ul>\n<li>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.<\/li>\n<li>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\u00c2\u00a0because\u00c2\u00a0in 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.<\/li>\n<li>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<\/li>\n<\/ul>\n<div>We should 70.2 first and then 70.1.<\/div>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3182\" title=\"20120730_updateRequest02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest02-300x124.jpg\" alt=\"\" width=\"300\" height=\"124\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest02-300x124.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest02.jpg 635w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3181\" title=\"20120730_updateRequest01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest01-300x78.jpg\" alt=\"\" width=\"300\" height=\"78\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest01-300x78.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest01.jpg 463w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3183\" title=\"20120730_updateRequest03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest03-300x113.jpg\" alt=\"\" width=\"300\" height=\"113\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest03-300x113.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest03.jpg 691w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>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.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3185\" title=\"20120730_updateRequest04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest04-181x300.jpg\" alt=\"\" width=\"181\" height=\"300\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest04-181x300.jpg 181w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_updateRequest04.jpg 261w\" sizes=\"auto, (max-width: 181px) 100vw, 181px\" \/><\/a><\/p>\n<p>You can download my example runbooks here, <a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2012\/07\/20120730_addActivity_Sanitize.zip\">20120730_addActivity_Sanitize<\/a>\u00c2\u00a0,\u00c2\u00a0please note that this is provided \u00e2\u20ac\u0153as is\u00e2\u20ac\u009d with no warranties at all.<\/p>\n<p>In\u00c2\u00a0<a title=\"Dynamic approval steps in Service Manager with a bit of Orchestrator magic\" href=\"http:\/\/contoso.se\/blog\/?p=2872\">this blog post<\/a>\u00c2\u00a0I show how activities in a service request can be updated by a runbook activity, for example dynamic approval steps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=3179\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[60,25],"tags":[],"class_list":["post-3179","post","type-post","status-publish","format-standard","hentry","category-orchestrator","category-system-center-service-desk"],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3179"}],"version-history":[{"count":3,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3179\/revisions"}],"predecessor-version":[{"id":3187,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3179\/revisions\/3187"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3179"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}