{"id":2169,"date":"2011-02-15T17:24:28","date_gmt":"2011-02-15T16:24:28","guid":{"rendered":"http:\/\/contoso.se\/blog\/?p=2169"},"modified":"2011-02-15T17:24:28","modified_gmt":"2011-02-15T16:24:28","slug":"get-old-operations-manager-alerts-with-opalis","status":"publish","type":"post","link":"http:\/\/contoso.se\/blog\/?p=2169","title":{"rendered":"Get Old Operations Manager Alerts with Opalis"},"content":{"rendered":"<p>I read a question on the forum about the \u00e2\u20ac\u0153Get Alert\u00e2\u20ac\u009d object in Opalis, that it doesn\u00e2\u20ac\u2122t support relative dates. That is correct and a bit sad too, it would be really nice to say \u00e2\u20ac\u0153now minus 7 days\u00e2\u20ac\u009d as we can do in the Operations Manager reporting console for example.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts011.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts011-300x200.jpg\" alt=\"\" title=\"20110212_OldAlerts01\" width=\"300\" height=\"200\" class=\"aligncenter size-medium wp-image-2170\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts011-300x200.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts011.jpg 603w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>But there is of course a solution to this \ud83d\ude42 You can start with a Format Date\/Time object in your workflow, that will generate the relative date for you. The output can then be used as input in the Get Alerts object.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts021.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts021-300x88.jpg\" alt=\"\" title=\"20110212_OldAlerts02\" width=\"300\" height=\"88\" class=\"aligncenter size-medium wp-image-2171\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts021-300x88.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts021.jpg 546w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts031.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts031-300x200.jpg\" alt=\"\" title=\"20110212_OldAlerts03\" width=\"300\" height=\"200\" class=\"aligncenter size-medium wp-image-2172\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts031-300x200.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts031.jpg 603w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>The Format Date\/Time object takes a variable as input, the variable is the current time in yyyy-MM-dd h:m:s format. The Format Date\/Time object then re-format the time and adjust the output date with minus 7 days.<\/p>\n<p><a href=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts041.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts041-300x199.jpg\" alt=\"\" title=\"20110212_OldAlerts04\" width=\"300\" height=\"199\" class=\"aligncenter size-medium wp-image-2173\" srcset=\"http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts041-300x199.jpg 300w, http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/20110212_OldAlerts041.jpg 606w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>There is a junction object in the policy too. This is used to make sure following objects only run once, regardless of the data provided in previous objects. Else \u00e2\u20ac\u0153Send Platform Event\u00e2\u20ac\u009d and \u00e2\u20ac\u009dDelete temp file\u00e2\u20ac\u009d would run once for every alert the Get Alert object returns. Instead I use a Append File object to write all alerts to a temp text file. On the other side of the junction object I pick up all the data again with the Get Lines object, the rest of the policy will then only run once. You can download my example here, <a href='http:\/\/contoso.se\/blog\/wp-content\/uploads\/2011\/02\/OldAlerts1.zip'>OldAlerts<\/a><\/p>\n<p>Please note that this is provided \u00e2\u20ac\u0153as is\u00e2\u20ac\u009d with no warranties at all.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I read a question on the forum about the \u00e2\u20ac\u0153Get Alert\u00e2\u20ac\u009d object in Opalis, that it doesn\u00e2\u20ac\u2122t support relative dates. That is correct and a bit sad too, it would be really nice to say \u00e2\u20ac\u0153now minus 7 days\u00e2\u20ac\u009d as we can do in the Operations Manager reporting console for example. But there is of &hellip; <a href=\"http:\/\/contoso.se\/blog\/?p=2169\">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":[58,19],"tags":[],"class_list":["post-2169","post","type-post","status-publish","format-standard","hentry","category-opalis","category-operations-manager-2007"],"_links":{"self":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2169","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=2169"}],"version-history":[{"count":4,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2169\/revisions"}],"predecessor-version":[{"id":2178,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2169\/revisions\/2178"}],"wp:attachment":[{"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2169"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/contoso.se\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}