{"id":3616,"date":"2013-06-16T18:54:59","date_gmt":"2013-06-16T16:54:59","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=3616"},"modified":"2013-06-17T10:48:20","modified_gmt":"2013-06-17T08:48:20","slug":"show-status-of-the-last-review-activity-with-a-pinch-of-orchestrator-magic","status":"publish","type":"post","link":"https:\/\/contoso.se\/blog\/?p=3616","title":{"rendered":"Show Status of the last Review Activity (with a pinch of Orchestrator magic)"},"content":{"rendered":"<p>A friend\u00c2\u00a0asked me if it is possible to show the status of a related\u00c2\u00a0review activity in the &#8220;All\u00c2\u00a0Open\u00c2\u00a0Service Requests&#8221; view?\u00c2\u00a0After a while we\u00c2\u00a0realized that a\u00c2\u00a0requirements was to show the status of the last review activities, so if there were multiple review activities we just wanted to show the last one. The reason why they needed this view was that customer called service desk and asked about service requests. With a view like this the operator could easy see if all the manual review activities was completed, if the service request was still waiting on more\u00c2\u00a0approvals\u00c2\u00a0or if someone was building\/working on\u00c2\u00a0the requested service.<\/p>\n<p>We started by extending the Service Request class in Service Manager with two new properties, one to show the last review activity status and one to show when we last updated that status.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus03.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3618\" alt=\"20130616_SRStatus03\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus03-300x159.jpg\" width=\"300\" height=\"159\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus03-300x159.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus03.jpg 577w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>We use a runbook to update these properties<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus02.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3619\" alt=\"20130616_SRStatus02\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus02-300x79.jpg\" width=\"300\" height=\"79\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus02-300x79.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus02.jpg 905w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Comprehensive description of each activity in the runbook<\/p>\n<ol>\n<li>Monitor Date\/Time. The runbook runs every 30 minutes<\/li>\n<li>Query Database. Truncates a database that is used to store data temporary. The runbook use a database table to store review activity information temporary.<br \/>\n<a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus04.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3625\" alt=\"20130616_SRStatus04\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus04-300x118.jpg\" width=\"300\" height=\"118\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus04-300x118.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus04.jpg 816w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/li>\n<li>Get Object. Gets all open Service Requests, from the extended Service Request class.<\/li>\n<li>Get Relationship. Get related Review Activities for each open Service Request<\/li>\n<li>Update\u00c2\u00a0Object. If there\u00c2\u00a0are no related review activities it will update the &#8220;LastStatus&#8221; property with &#8220;No Review Activities&#8221;<\/li>\n<li>Get Object. If there are related review activities it will get the review activity and write review activitiy and Service Request information to the database<\/li>\n<li>Junction is used to merge all threads together to one<\/li>\n<li>Format the current time\/date to a format that works with Service Manager<\/li>\n<li>Query Database. Query the database to get last review activity for each Service Request and status of it<\/li>\n<li>Update Object. Updates each Service Request that is in the database with review activity status<\/li>\n<\/ol>\n<p>The result in the Service Manager console can look like this<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus01.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-medium wp-image-3621\" alt=\"20130616_SRStatus01\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus01-300x55.jpg\" width=\"300\" height=\"55\" srcset=\"https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus01-300x55.jpg 300w, https:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus01.jpg 781w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can download my example runbook and Service Manager class extension here, <a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2013\/06\/20130616_SRStatus.zip\">20130616_SRStatus<\/a><\/p>\n<p>Note that this is provided \u00e2\u20ac\u0153AS-IS\u00e2\u20ac\u009d with no warranties at all. This is not a production ready management pack or solution, just a idea and an example.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A friend\u00c2\u00a0asked me if it is possible to show the status of a related\u00c2\u00a0review activity in the &#8220;All\u00c2\u00a0Open\u00c2\u00a0Service Requests&#8221; view?\u00c2\u00a0After a while we\u00c2\u00a0realized that a\u00c2\u00a0requirements was to show the status of the last review activities, so if there were multiple review activities we just wanted to show the last one. The reason why they needed &hellip; <a href=\"https:\/\/contoso.se\/blog\/?p=3616\">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},"categories":[60,25],"tags":[],"_links":{"self":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3616"}],"collection":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3616"}],"version-history":[{"count":5,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3616\/revisions"}],"predecessor-version":[{"id":3624,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3616\/revisions\/3624"}],"wp:attachment":[{"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3616"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3616"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}