I am trying to create an automation that assigns a custom field (out of hours/ in hours) that runs when a work item is resolved. The automation uses if / else blocks and is working for saturday/sundays and public holidays, but i am having an issue for this work items which are resolved between 8.00am and 10.am. The in hours should start from 09.00am. So any issue resolved up to 9.00am should be out of hours. Those after 9.00am should be in hours. The condition i am using is
First value
{{issue.resolutiondate.format("HHmm")|int}}
Condition
Less than
Second Value
900
The exported json is below
{"cloud":true,"rules":[{"id":2307367,"clientKey":"7038b03b-c0f6-351b-80f8-3e97b0915dd6","name":"\"Resolved Time Category\"","state":"ENABLED","description":"","authorAccountId":"5c4f0ceaa1c91017b40323be","actor":{"type":"ACCOUNT_ID","value":"557058:f58131cb-b67d-43c7-b30d-6b58d40bd077"},"created":1759938295848,"updated":1760361901076,"trigger":{"id":"f4dcba0b-7d9a-41af-832d-bba76f99e6dc","component":"TRIGGER","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.issue.event.trigger:transitioned","value":{"fromStatus":[],"toStatus":[{"type":"NAME","value":"Done"}],"eventFilters":["ari:cloud:jira:79a2d3ea-d9fb-4c08-96e1-54581cce2f9d:project/10020"],"eventKey":"jira:issue_updated","issueEvent":"issue_generic"},"children":[],"conditions":[{"id":"e1da0079-f4a8-4b4d-b894-0009d88899e4","component":"CONDITION","parentId":null,"conditionParentId":"f4dcba0b-7d9a-41af-832d-bba76f99e6dc","schemaVersion":3,"type":"jira.issue.condition","value":{"selectedField":{"type":"ID","value":"issuetype"},"selectedFieldType":"issuetype","comparison":"ONE_OF","compareValue":{"type":"ID","modifier":null,"value":"[\"10013\",\"10020\"]","multiValue":true,"source":null}},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},"components":[{"id":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","component":"CONDITION","parentId":null,"conditionParentId":null,"schemaVersion":1,"type":"jira.condition.container.block","value":null,"children":[{"id":"935c4288-4f63-4f46-b82c-1777e474fdb5","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"0e480a91-1992-46df-83d6-090a24a7058b","component":"ACTION","parentId":"935c4288-4f63-4f46-b82c-1777e474fdb5","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"Out of Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"02fa8f61-45a9-4f6d-8547-245f70068dc4","component":"CONDITION","parentId":null,"conditionParentId":"935c4288-4f63-4f46-b82c-1777e474fdb5","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.resolutiondate.format(\"E\")}}","second":"Sat","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"444902af-8e85-4099-afe6-fecdced407d9","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"57f7c0d2-fd6b-4626-985f-3f1d8856c61b","component":"ACTION","parentId":"444902af-8e85-4099-afe6-fecdced407d9","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"Out of Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"bd63f11a-241b-4575-b94c-b87e725ee102","component":"CONDITION","parentId":null,"conditionParentId":"444902af-8e85-4099-afe6-fecdced407d9","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.resolutiondate.format(\"E\")}}","second":"Sun","operator":"EQUALS"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"4a3b0417-fa0b-4669-9fe7-f6eaf0406d76","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"a436a5b8-3696-49d2-b70e-e94501dbc6ba","component":"ACTION","parentId":"4a3b0417-fa0b-4669-9fe7-f6eaf0406d76","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"Out of Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"7e951a57-4ff3-469c-a8e1-c4badb41681a","component":"CONDITION","parentId":null,"conditionParentId":"4a3b0417-fa0b-4669-9fe7-f6eaf0406d76","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.resolutiondate.format(\"HHmm\")|int}}","second":"900","operator":"LESS_THAN"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"2d669ec8-2188-4aac-8a64-6bfe19fa5b50","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"7cf59cee-4ff9-47fa-841c-8a8cd3116ce6","component":"ACTION","parentId":"2d669ec8-2188-4aac-8a64-6bfe19fa5b50","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"Out of Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"1c12c015-32e6-4150-a747-4538222f3829","component":"CONDITION","parentId":null,"conditionParentId":"2d669ec8-2188-4aac-8a64-6bfe19fa5b50","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.resolutiondate.format(\"HHmm\")|int}}","second":"1730","operator":"GREATER_THAN"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"b919adbd-7708-4b2c-ba0f-70b077e49535","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"67cce16c-9c9f-4c3d-bcd4-581f02dca6a4","component":"ACTION","parentId":"b919adbd-7708-4b2c-ba0f-70b077e49535","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"Out of Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[{"id":"894ceea8-8082-402e-b7ce-c21896d69216","component":"CONDITION","parentId":null,"conditionParentId":"b919adbd-7708-4b2c-ba0f-70b077e49535","schemaVersion":1,"type":"jira.comparator.condition","value":{"first":"{{issue.resolutiondate.format(\"yyyy-MM-dd\")}}","second":"^(2025-01-01|2025-02-10|2025-03-19|2025-03-31|2025-04-18|2025-05-01|2025-06-07|2025-06-29|2025-08-15|2025-09-08|2025-09-21|2025-12-08|2025-12-13|2025-12-25)$","operator":"REGEX_MATCHES"},"children":[],"conditions":[],"connectionId":null}],"connectionId":null},{"id":"72c8c254-f2dc-40f7-8e4d-788b245a594e","component":"CONDITION_BLOCK","parentId":"8b258b0d-df9f-4409-bd75-6f15fde1ebab","conditionParentId":null,"schemaVersion":1,"type":"jira.condition.if.block","value":{"conditionMatchType":"ALL"},"children":[{"id":"1955d747-7948-418d-ba65-6fe5eaf6b755","component":"ACTION","parentId":"72c8c254-f2dc-40f7-8e4d-788b245a594e","conditionParentId":null,"schemaVersion":12,"type":"jira.issue.edit","value":{"operations":[{"field":{"type":"NAME","value":"Resolved Time Category"},"fieldType":"com.atlassian.jira.plugin.system.customfieldtypes:select","type":"SET","value":{"type":"NAME","value":"In Hours"}}],"advancedFields":null,"sendNotifications":true},"children":[],"conditions":[],"connectionId":null}],"conditions":[],"connectionId":null}],"conditions":[],"connectionId":null}],"canOtherRuleTrigger":false,"notifyOnError":"FIRSTERROR","projects":[],"labels":[],"tags":[{"id":3852076,"ruleIdUuid":"0199c47f-3826-7e9e-a7ed-488f57613672","tagType":"IS_RULE_UPDATED","tagValue":"true"}],"ruleScope":{"resources":["ari:cloud:jira:79a2d3ea-d9fb-4c08-96e1-54581cce2f9d:project/10020"]},"ruleHome":{"ruleLifecycleHome":{"locationARI":"ari:cloud:jira:79a2d3ea-d9fb-4c08-96e1-54581cce2f9d:project/10020"},"ruleBillingHome":{"locationARI":"ari:cloud:jira-software::site/79a2d3ea-d9fb-4c08-96e1-54581cce2f9d"}},"writeAccessType":"UNRESTRICTED","collaborators":[],"billingType":"NORMAL","idUuid":"0199c47f-3826-7e9e-a7ed-488f57613672","partitionId":"60638760-6f8f-4d67-9a99-1d58de8cb68d","currentVersionId":null}]}
Hi @Vince Clark
Thanks for the interesting question.
I try this one, and seems it worked.
- For weekend → Out of Hours
First value:{{issue.resolutiondate.convertToTimeZone("Asia/Yerevan").format("E")}}
Condition: Regex matches(?i)^(Sat|Sun)$
- For
Before 09:00 → Out of Hours
First value:{{issue.resolutiondate.convertToTimeZone("Asia/Yerevan").format("HHmm")|int}}
Condition: Less than
900
- For
After 17:30 → Out of Hours
First value:{{issue.resolutiondate.convertToTimeZone("Asia/Yerevan").format("HHmm")|int}}
Condition: Greater than1730
- For Public holidays → Out of Hours
First value:{{issue.resolutiondate.convertToTimeZone("Asia/Yerevan").format("yyyy-MM-dd")}}
Condition: Regex matches^(2025-01-01|2025-02-10|2025-03-19|2025-03-31|2025-04-18|2025-05-01|2025-06-07|2025-06-29|2025-08-15|2025-09-08|2025-09-21|2025-12-08|2025-12-13|2025-12-25)$
You should change the time zone to your own.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.