{"id":4033,"date":"2014-07-02T21:50:50","date_gmt":"2014-07-02T19:50:50","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=4033"},"modified":"2014-07-02T21:53:23","modified_gmt":"2014-07-02T19:53:23","slug":"how-many-instances-of-this-activity-do-we-have-and-where-are-they","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=4033","title":{"rendered":"How many instances of this activity do we have? And where are they?"},"content":{"rendered":"<p>From time to time there is a need to list all instances of a specific activity type in Orchestrator. For example it is not recommended to have any send platform event activities in production, instead we can use a SQL database for logging. There are two ways to investigate if there are any send platform events in the environment, review each runbook or ask the database. In this blog post I will show you how to list all instances of a specific activity type.<\/p>\n<p>The first thing we need to do is to find the uniqueID for the type of activity in the OBJECTTYPES table. The following question will give us all info about the Send Platform Event, but you can query for any kind of activity.<\/p>\n<p><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">select\u00c2\u00a0<\/span><span style=\"color: gray;\">* <\/span><span style=\"color: blue;\">from<\/span> <span style=\"color: teal;\">OBJECTTYPES<\/span> <span style=\"color: blue;\">where<\/span> <span style=\"color: teal;\">name<\/span> <span style=\"color: gray;\">=<\/span> <span style=\"color: red;\">&#8216;Send Platform Event&#8217;<br \/>\n<\/span><\/span><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2014\/07\/070214_1950_Howmanyinst1.png\" alt=\"\" \/><span style=\"color: red; font-family: Consolas; font-size: 9pt;\"><br \/>\n<\/span><\/p>\n<p>The OBJECTTYPE table will give us the uniqueID for the activity type, in this example 87E28B20-3E83-45E0-985A-FEEA6CE09084. The table will also tell us where to look for configuration data for these activities, in the PrimaryDataTables and SecondaryDataTables. If we want to list all Send Platform Events activities we have we can run the following query. The &#8220;AND (Deleted = &#8216;0&#8217;) part will make sure we only list activities that are not marked as deleted.<\/p>\n<p><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">select<\/span>\u00c2\u00a0<span style=\"color: gray;\">*<\/span> <span style=\"color: blue;\">from<\/span> <span style=\"color: green;\">OBJECTS<\/span> <span style=\"color: blue;\">where <span style=\"color: gray;\">(<span style=\"color: teal;\">ObjectType<\/span> =<\/span> <span style=\"color: red;\">&#8217;87E28B20-3E83-45E0-985A-FEEA6CE09084&#8242;<span style=\"color: gray;\">)<\/span> <span style=\"color: gray;\">AND<span style=\"color: blue;\"> <span style=\"color: gray;\">(<span style=\"color: teal;\">Deleted<\/span> =<\/span> <span style=\"color: red;\">&#8216;0&#8217;<span style=\"color: gray;\">)<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p>If we now want to add on in which runbook we are using them we can join the ParentID from the OBJECTS table with the uniqueID in the POLICIES table, like the following query. The Objects table will give us general information about each activity.<\/p>\n<p><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">SELECT<\/span> <span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">Name<\/span> <span style=\"color: blue;\">AS<\/span> <span style=\"color: teal;\">[Activity Name]<span style=\"color: gray;\">,<\/span> POLICIES<span style=\"color: gray;\">.<span style=\"color: teal;\">Name<\/span> <span style=\"color: blue;\">AS<\/span> <span style=\"color: teal;\">[Runbook Name]<\/span> <\/span><\/span><\/span><\/span><\/span><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">FROM<\/span> <span style=\"color: green;\">OBJECTS<\/span> <span style=\"color: gray;\">INNER<\/span> <span style=\"color: gray;\">JOIN<\/span><\/span><span style=\"font-family: Consolas; font-size: 9pt;\"> <span style=\"color: teal;\">POLICIES<\/span><br \/>\n<span style=\"color: blue;\">ON<\/span><br \/>\n<span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">ParentID<\/span> =<\/span> <span style=\"color: teal;\">POLICIES<span style=\"color: gray;\">.<span style=\"color: teal;\">UniqueID <\/span><\/span><\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt;\">WHERE <span style=\"color: gray;\">(<span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">ObjectType<\/span> =<\/span> <span style=\"color: red;\">&#8217;87E28B20-3E83-45E0-985A-FEEA6CE09084&#8242;<span style=\"color: gray;\">)<\/span> <span style=\"color: gray;\">AND<span style=\"color: blue;\"> <span style=\"color: gray;\">(<span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">Deleted<\/span> =<\/span> <span style=\"color: red;\">&#8216;0&#8217;<span style=\"color: gray;\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p><span style=\"color: blue; font-family: Consolas; font-size: 9pt;\"><span style=\"color: gray;\"><span style=\"color: green;\"><span style=\"color: red;\"><span style=\"color: gray;\"><span style=\"color: blue;\"><span style=\"color: gray;\"><span style=\"color: green;\"><span style=\"color: red;\"><span style=\"color: gray;\"><br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><img decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2014\/07\/070214_1950_Howmanyinst2.png\" alt=\"\" \/><span style=\"color: gray; font-family: Consolas; font-size: 9pt;\"><br \/>\n<\/span><\/p>\n<p>We now see activity names and runbook names. But what if we also want to include configuration of the Send Platform Event activity? Then we need to join the table seen in the first query, the PrimaryDataTable for the Send Platform Event activity type, example query<\/p>\n<p><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">SELECT<\/span> <span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">Name<\/span> <span style=\"color: blue;\">AS<\/span> <span style=\"color: teal;\">[Activity Name]<span style=\"color: gray;\">,<\/span> POLICIES<span style=\"color: gray;\">.<span style=\"color: teal;\">Name<\/span> <span style=\"color: blue;\">AS<\/span> <span style=\"color: teal;\">[Runbook Name]<span style=\"color: gray;\">,<\/span> TASK_SENDOPALISEVENT<span style=\"color: gray;\">.<span style=\"color: teal;\">EventType<span style=\"color: gray;\">,<\/span> TASK_SENDOPALISEVENT<span style=\"color: gray;\">.<span style=\"color: teal;\">EventSummary<span style=\"color: gray;\">,<\/span> TASK_SENDOPALISEVENT<span style=\"color: gray;\">.<span style=\"color: teal;\">EventDetails <\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><span style=\"font-family: Consolas; font-size: 9pt;\"><span style=\"color: blue;\">FROM<\/span> <span style=\"color: green;\">OBJECTS<\/span><br \/>\n<span style=\"color: gray;\">INNER<\/span> <span style=\"color: gray;\">JOIN<\/span><\/span><span style=\"font-family: Consolas; font-size: 9pt;\"> <span style=\"color: teal;\">POLICIES<\/span> <span style=\"color: blue;\">ON<\/span> <span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">ParentID<\/span> =<\/span> <span style=\"color: teal;\">POLICIES<span style=\"color: gray;\">.<span style=\"color: teal;\">UniqueID<\/span> INNER<\/span> <span style=\"color: gray;\">JOIN<\/span><\/span><\/span><\/span><span style=\"font-family: Consolas; font-size: 9pt;\"> <span style=\"color: teal;\">TASK_SENDOPALISEVENT<\/span> <span style=\"color: blue;\">ON<\/span> <span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">UniqueID<\/span> =<\/span> <span style=\"color: teal;\">TASK_SENDOPALISEVENT<span style=\"color: gray;\">.<span style=\"color: teal;\">UniqueID <\/span><\/span><\/span><\/span><\/span><span style=\"color: blue; font-family: Consolas; font-size: 9pt;\">WHERE <span style=\"color: gray;\">(<span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">ObjectType<\/span> =<\/span> <span style=\"color: red;\">&#8217;87E28B20-3E83-45E0-985A-FEEA6CE09084&#8242;<span style=\"color: gray;\">)<\/span> <span style=\"color: gray;\">AND<span style=\"color: blue;\"> <span style=\"color: gray;\">(<span style=\"color: green;\">OBJECTS<span style=\"color: gray;\">.<span style=\"color: teal;\">Deleted<\/span> =<\/span> <span style=\"color: red;\">&#8216;0&#8217;<span style=\"color: gray;\">)<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2014\/07\/070214_1950_Howmanyinst3.png\" alt=\"\" \/><\/p>\n<p>AS you can see some EventDetails and EventSummary includes a GUID. When we configure a Send Platform Event activity to publish data from the data bus we see the uniqueID of the activity in the text. As we can see in the figure many of my Send Platform Events will use data from the data bus.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From time to time there is a need to list all instances of a specific activity type in Orchestrator. For example it is not recommended to have any send platform event activities in production, instead we can use a SQL database for logging. There are two ways to investigate if there are any send platform &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=4033\">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],"tags":[],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4033"}],"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=4033"}],"version-history":[{"count":3,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4033\/revisions"}],"predecessor-version":[{"id":4037,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4033\/revisions\/4037"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4033"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}