Cheat Sheet

Modified on Tue, 12 Nov at 3:29 PM

Cheat Sheet

Special contexts

  • #{ }: to access context variables
  • ?{ }?: to open a JavaScript context
  • §{ }§: when accessing the component configuration
  • ${ }: to access translations
  • <![CDATA[ ]]>: use whenever you are not using pure XML

Scopes

  • step: the currently active step
  • workflow: all steps of the current component
  • root: all components of the workflow
  • user_session: all workflows the user accesses before logging out

Data Types

  • string, bool, double, long, object

States

  • <onenter>: This is the first state when a step is entered. The user interface is not available in this state, as a result, you cannot use UI-related actions. However, if you want to initialize parameters to use them for UI mapping, then this is the correct state to do so.
  • <onresume>: The second state after <onenter>. In this state, the UI is available and you can modify the loaded layout with the UI update actions.
  • <onpause> and <onleave>: These states occur whenever you leave the current step or the whole component by using the step_transition or finish_workflow actions. Since the transitions are not interruptible, you cannot use rules here that use these actions. In theonpause state, the resources of the step still exist in onleave, they do not.
  • <onevent>: This is probably the most important state. Rules defined in this state will be checked every time an event gets processed. All the rules related to interactions with the user are defined in this state.

Operators

  • Available in expressions: +, -, &&, ||, !, /, ==, >, >=, <, <=, %, *, !=

Event structure

  • command: The command of this event, e.g., “NEXT”. The command may, for example, correspond to an ID in the layout or workflow description of your component. Example: #{event:command} == ‘CANCEL’
  • device.modality: The source of the event. This field can be accessed using a short notation
  • The expression #{event(SPEECH):command==’NEXT’ is equivalent to the expression #{event:device.modality} == ‘SPEECH’ && #{event:command} == ‘NEXT’. The modality depends on the event emitter. Example: #{event:device.modality} == ‘MENU_SELECTION’
  • payload: The structure/ fields of the payload, are dependent on the action/handler that triggers the event. Example: #{event:payload.amount}
  • payload.error: Contains an error message if there is one. Example: #{event:payload.error}

Embedded functions

  • exists: exists(#{shelve})
  • toUppercase: toUppercase( ‘#{material_name} ‘ )
  • toLowercase: toLowercase( ‘#{material_name} ‘ )
  • trim: trim( # {material_name} )
  • contains: contains( # {first_code}, #{second_code})
  • startsWith: startsWith( # {first_code}, #{second_code})
  • endsWith: endsWith( # {first_code}, #{second_code})
  • equals: equals( # {first_code}, #{second_code})
  • substring: substring( # {material_name}, 0, 3)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article