# Workflow Condition to Run if AM Run a series of HTTP Requests  If PM Run Another series of HTTP Requests

**URL:** <https://community.dynatrace.com/t/workflow-condition-to-run-if-am-run-a-series-of-http-requests-if-pm-run-another-series-of-http-requests/47505>\
**Category:** Automations\
**Tags:** workflows, maintenance-window, automations\
**Created:** [September 5, 2024, 4:28pm UTC](https://community.dynatrace.com/t/workflow-condition-to-run-if-am-run-a-series-of-http-requests-if-pm-run-another-series-of-http-requests/47505 "2024-09-05T16:28:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CTull](https://avatars.discourse-cdn.com/v4/letter/c/da6949/32.png) [@CTull](https://community.dynatrace.com/u/CTull)\
**Post date:** [September 5, 2024, 4:28pm UTC](https://community.dynatrace.com/t/workflow-condition-to-run-if-am-run-a-series-of-http-requests-if-pm-run-another-series-of-http-requests/47505/1 "2024-09-05T16:28:23Z")

</div>

I have a dilemma where I am to create a maintenance window to prevent alerts from 6pm to 6am.&nbsp; This is log ingestion via API, that does not contain many details to allow for a criteria for filtering to allow for a maintenance window.&nbsp; SOOO, doing a work around using workflows to make an api call to Dynatrace to enable\disable the event extraction entities between 6pm and 6am.

So I have the api for enable\disable for the extraction event.&nbsp; However, there is only one trigger and I have that set to run at 6am and 6pm.&nbsp; BUT the condition I do not know the syntax for and I am not seeing any syntax for it in the documentation.

Condition would be to run is if time is AM run the Enable, if time is PM run disable api.

I am open to other conditions or ideas but it must be in 1 workflow as I only have 3 workflows to utilize.&nbsp; I can use another workflow but I do not want to do that.&nbsp; NOT a DPS customer yet.&nbsp; In this layout both run at 6am and 6pm which enables and disables them and is doing nothing.&nbsp; Also maintaining within one workflow for this one process keeps things organized.

 ![CTull_1-1725553441147.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/d/ad3f11b81e548737deebba80db220e595b69f427.png)

---

<div class="post-metadata">

**Author:** ![ChristopherHejl](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopherhejl/32/20735_2.png) [@ChristopherHejl](https://community.dynatrace.com/u/ChristopherHejl)\
**Post date:** [September 5, 2024, 5:49pm UTC](https://community.dynatrace.com/t/workflow-condition-to-run-if-am-run-a-series-of-http-requests-if-pm-run-another-series-of-http-requests/47505/2 "2024-09-05T17:49:23Z")

</div>

Hi,

you can use expression in the condition [Build workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/platform-modules/automations/workflows/building#task-conditions)  
In this case, the now expression should be most useful [Jinja expressions for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/platform-modules/automations/workflows/reference#now)

With this, you can get the current timestamp in any format for any timezone and compare.  
I suggest either to extract the current hour and compare with \> \< 12, or there is even a format to get AM / PM out.

Sample condition:

```python
{{ now('US/Eastern').strftime("%p") == "PM" }}

```

 ![ChristopherHejl_0-1725558456164.png](https://global.discourse-cdn.com/dynatrace/original/3X/3/e/3ef0996a951826860077b7f380f37183b6906cec.png)

I’ll also attach this sample workflow as an export so can either import it into your tenant and have a look or just look into the definition.  
[wftpl\_time\_based\_condition.zip](https://community.dynatrace.com/uploads/short-url/lUoRoUedEckAVHFvtKk813u0nPI.zip) (762 Bytes)
