core2-jvm (latest)
core2-jvm (latest)core-jvm
  • Home
  • Features
  • Spec
  • Guides
  • Sandbox
  • Step Studio
  • Step
    • Action
    • External
    • Help
    • Link Handler
    • Navigation
    • Persist Async
    • Polling
    • Refresh On Change
    • Schema On Change
    • Step Error
    • Suggestions
    • Summary
    • Toolbar
    • Upload
    • Validate Async
    • Schema
    • All Of Schema
    • Array Schema
    • Blob Schema
    • Boolean Schema
    • Const Schema
    • Integer Schema
    • Number Schema
    • Object Schema
    • One Of Schema
    • String Schema
    • Layout
    • Alert Layout
    • Box Layout
    • Button Layout
    • Columns Layout
    • Decision Layout
    • Divider Layout
    • Form Layout
    • Heading Layout
    • Image Layout
    • Instructions Layout
    • List Layout
    • Loading Indicator Layout
    • Markdown Layout
    • Media Layout
    • Modal Layout
    • Paragraph Layout
    • Progress Layout
    • Review Layout
    • Search Layout
    • Section Layout
    • Status List Layout
    • Tabs Layout
    • Upsell Layout
    • Behavior
    • Action Behavior
    • Copy Behavior
    • Dismiss Behavior
    • Link Behavior
    • Modal Behavior
    • Refresh Behavior
    • Subflow Behavior
    • Subflow
    • Dynamic Launch Config
    • Launch Config
    • Modal Presentation
    • Native Launch Config
    • Presentation
    • Push Presentation
    • Action Response Body
    • Error Response Body
    • Flow Response
    • Modal Response Body
    • No Op Response Body
    • Search Initial Layout Config
    • Search Initial Results Config
    • Search Initial State
    • Search Layout Response Body
    • Search Response
    • Search Response Body
    • Search Result
    • Search Results Response Body
    • Subflow Response Body
    • Additional Info
    • Align
    • Autocapitalization Type
    • Autocomplete Token
    • Context
    • Icon
    • Image
    • Inline Alert
    • Media
    • Native Capabilities
    • Request
    • Size
    • Supporting Values
    • Control
    • Tag

Action

Android - 8.25.0 iOS - 11539 Web - 2.5.0

An action may be performed by the user when submitting a step. Actions can submit to an endpoint, progress the flow, or exit the flow.

An action typically defines its URL and HTTP method to submit step data, and can optionally indicate that, on success, the flow must end.

An endpoint can respond to a submitting action with an error status code and the standard error response format in order to display errors to the user.

Behavior

If an action does not specify the exit property as true, it is expected that the action will submit the step payload. For example, the following action is a non-exiting action.

action {
    url = "/submitForm"
    method = HttpMethod.POST
}

Exiting Actions

If an action specifies exit as true, it is expected that this action should terminate the flow. For exiting actions, the url property is optional.

If the url property is not specified, when the action is taken the flow will be terminated and the value of the result property will be used as the result of the flow.

Example

Given the following action:

action {
    exit = true
    result = encodeToJsonElement(mapOf(
        "someKey" to "someValue"
    ))
}

When this action is taken, the flow will be completed and the result of the flow will be:

{
  "someKey": "someValue"
}

Submitting Exiting Actions (Not recommended)

If the url property is specified, the step payload will be submitted. On a successful response, the result property of the action (if provided) will be merged with the response to the submission, and that combined result will be used as the result of the flow, which will terminate. In case of any conflicts in the merge, the value of the result property of the action takes precedence.

However, it is not recommended to use this approach. Instead, a non-exiting action should be used to submit the step payload, and the flow should be terminated by the server by returning an X-DF-Response-Type: exit header in the response. See "Actions Which Sometimes Exit" for more information.

Actions Which Sometimes Exit

In some cases, the provider of the step will not know if a submitting action will exit. For example, depending on the data entered by the user, the flow may be complete, or we may need to ask them some follow-up questions. In these cases the exit property shouldn’t be specified. Instead, the response to the submission should include an X-DF-Response-Type: exit header. When the client receives this header in the response, it will continue in the same way as it would for a submitting exiting action. See Flow Response.

Summary

This tree summarises the possible paths an action can lead to:

  • If exit is true:
    • If url is null:
      • Exit flow with value of result
    • If url is non-null: (not recommended)
      • Submit to url
      • Merge value of result into response body
      • Exit flow with the merged result
  • If exit is false, or not provided:
    • Submit to url
    • If response has header X-DF-Response-Type: "exit":
      • Merge value of result into response body
      • Exit flow with the merged result
    • If response does not have header X-DF-Response-Type: "exit":
      • The response is handles as normal

Properties

PropertyTypeRequiredDescription
dataAnyNoAn object to be merged with the step data before submission.
exitBooleanNoSee 'Exiting Actions'.
idStringNoA unique id which can be used for analytics purposes.
methodStringNoThe HTTP method to use for the async submission. Defaults to POST.

prefetch

Boolean

No

Indicates that the action is safe to be pre-fetched, i.e. before the action is triggered. Typically, this is done when the step is loaded.

Android - 9.11.0 iOS - 9.7 Web - 5.1.0

resultAnyNoSee 'Exiting Actions'.

skipValidation

Boolean

No

Indicates that the action should not trigger client-side validation.

Android - 8.31.0 iOS - 8.30 Web - 2.5.0

timeoutIntNoSuggested 'timeout' duration, in seconds, for the network request resulting from this action. Typically used when the endpoint is expected to take a long time to respond.
urlStringNoThe URL to use for the submission.