{
    "componentChunkName": "component---src-templates-article-page-template-js",
    "path": "/references/transaction-process-time-expressions/",
    "result": {"data":{"markdownRemark":{"frontmatter":{"title":"Transaction process time expressions","slug":"transaction-process-time-expressions","updated":"2022-02-09T00:00:00.000Z","category":"references","ingress":"This reference article describes the time expressions used in the transaction process.","skills":null},"htmlAst":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Time expressions can be used both with transitions and notifications to\ndelay the execution. The Flex transaction engine exposes a set of\ntimepoints that you can tie delays to as well as a small set of\nfunctions to further control the exact timing. The basic structure of a\ntime expression is a map from function name to a list (vector) of\nfunction parameters:\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/function-name [function-param1 function-param2]}"}]},{"type":"text","value":". For example:\n"},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{fn/timepoint [:time/booking-end]"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"When a delayed transition or notification is scheduled, it will execute\nat the resulting time. However, if the transition moves forward before\nthe scheduled moment, the operation is automatically cancelled. This way\nyou can send a reminder notification or schedule an automatic\ncancellation after a certain time period that will be executed only in\nthe case that nobody takes action before that. Also, if the scheduled\ntime is in the past the operation will execute immediately. By wrapping\nthe time expression with "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/ignore-if-past"}]},{"type":"text","value":" you can instead ignore\noperations when the scheduled time is in the past."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Note that your transaction process can have several automatic\ntransitions "},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"scheduled"}]},{"type":"text","value":" for a state, but only one automatic transition\n"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"executed"}]},{"type":"text","value":" for a state. You may have e.g. one automatic transition\nscheduled to execute 1 day after first entering the state, and another\nscheduled to execute 7 days before a booking starts. The transition that\ngets executed is the one whose time point is matched first. However, if\nthe first automatic transition fails for some reason, no further\nautomatic transitions get executed from the state."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"To learn more how to use time expressions in the transaction process,\nsee the\n"},{"type":"element","tagName":"a","properties":{"href":"/docs/legacy/references/transaction-process-format/"},"children":[{"type":"text","value":"Transaction process format"}]},{"type":"text","value":"\nreference article."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"time-functions","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#time-functions","ariaLabel":"time functions permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Time functions"}]},{"type":"text","value":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Fn"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Arguments"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Example"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/timepoint"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"timepoint name + timepoint args (if any)"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Returns the timestamp of a timepoint in the process."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/first-entered-state :state/state-name]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/period"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Period expression, string"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A timespan that can be added or substracted."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/period [\"PT15M\"]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/min"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Two or more timestamps."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Returns the smallest (earliest) of all given timestamps."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/min [{:fn/timepoint [:time/booking-start]} {:fn/timepoint [:time/booking-display-start]}]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/plus"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A timestamp + 1 or more timespans"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Returns the timestamp with all the timespans added to it."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/plus [{:fn/timepoint [:time/booking-start]} {:fn/period \"P1D\"}]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/minus"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A timestamp + 1 or more timespans"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Returns the timestamp with all the timespans substracted from it."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{fn/minus [{:fn/timepoint [:time/booking-end]} {:fn/period \"P2D\"}]"}]},{"type":"text","value":":}"}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/ignore-if-past"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A timestamp"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Returns the given timestamp as is unless it's in the past, in which cases returns nothing. Returning nothing from a time expression cancels scheduling the operation."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/ignore-if-past [{:fn/timepoint [:time/booking-start]}]}"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The time functions can be nested freely."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"period-expressions","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#period-expressions","ariaLabel":"period expressions permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Period expressions"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The function "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":fn/period"}]},{"type":"text","value":" accepts an ISO 8601 duration as string. For\nmore about the ISO 8601 duration format see:\n"},{"type":"element","tagName":"a","properties":{"href":"https://en.wikipedia.org/wiki/ISO_8601#Durations","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"https://en.wikipedia.org/wiki/ISO_8601#Durations"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"timepoints","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#timepoints","ariaLabel":"timepoints permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Timepoints"}]},{"type":"text","value":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Timepoint"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Arguments"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Example"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/tx-initiated"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The timestamp for when the transaction was initiated."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/tx-initiated]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/first-entered-state"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"State name as keyword."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The timestamp when the process entered the given state for the first time. Processes may contain loops so a state can be entered multiple times."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/first-entered-state :state/state-name]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/first-transitioned"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Transition name as keyword."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The timestamp when the process executed the given transition successfully for the first time."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/first-transitioned :transition/transition-name]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/booking-start"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The booking start timestamp."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/booking-start]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/booking-end"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The booking end timestamp."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/booking-end]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/booking-display-start"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The booking display start timestamp."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/booking-start]}"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":":time/booking-display-end"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"-"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"The booking display end timestamp."}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"{:fn/timepoint [:time/booking-end]}"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"A booking always has start and end times. You may optionally specify\ndisplay start and display end times via transition parameters. Start and\nend times are used by all actions that automatically calculate prices\nbased on booking length. The automatic availability management also\nrelies on start and end times. The display versions of the start and end\ntimes are just for showing to users in the UI but you can additionally\nuse them in time expressions and transaction email templates. Finally,\nif display times are not specified via transition params they default to\nbooking start and end times."}]}],"data":{"quirksMode":false}},"headings":[{"value":"Time functions","depth":2},{"value":"Period expressions","depth":2},{"value":"Timepoints","depth":2}]}},"pageContext":{"slug":"transaction-process-time-expressions","category":"references"}},
    "staticQueryHashes": ["3794076007","439097193","717698143"]}