Skip to content

App Context and Context Selection

App context scopes the workspace to a record or business situation. A context switcher lets users choose that scope before opening the working app.

Context sources

$context.$app.$OraAppContext contains the current app context string. It may originate from a launch URL, app-to-app navigation, or a Switch App Context action. Parse JSON context defensively before using its fields.

App Context Switcher

The App Context Switcher presents a selection view before the scoped workspace opens. A workflow supplies the choices, handles searches, and can optionally choose a default context. Selecting an item calls ora.App.setContext(appCtx) with the context string that the app's agents subsequently read through $context.$app.$OraAppContext.

Configure the switcher in App Settings

  1. Open the app in App Builder and open the property panel to App Settings.
  2. Turn on Enable app context switching.
  3. In App Context Switching, set Agent to the workflow that supplies context suggestions.
  4. Set Search Placeholder to a useful instruction for the type of context users select.

For a supplier workspace, use a search placeholder such as Select a supplier. Configure the workflow's display-producing LLM or Agent node with Messages List under App Experience → Select the widgets you want to use. See Configure Agents for agent exposure and widget configuration.

Workflow request and response contract

When the app has context switcher view enabled, its initial request has:

$context.$app.$OraMessageHint = InitContextSuggestions
$context.$app.$OraRequestDefaultAppContext = true

If a default is appropriate, return an object with name and appContext:

{
  "name": "Supplier SUP-1042",
  "appContext": "{\"supplierId\":\"SUP-1042\"}"
}

The app immediately reloads using that context. Return a default only when $OraRequestDefaultAppContext is true. On return to the switcher from a scoped app, the flag is false and the workflow must show choices.

Without a default, return one <oraInfoDisplay> containing a messageListWidget. Each item represents a context and invokes ora.App.setContext(appCtx), where appCtx is a string.

<oraInfoDisplay key="supplier-contexts">
{
  "patternId": "messageListWidget",
  "properties": {
    "items": [
      {
        "title": "Supplier SUP-1042",
        "summary": "Open supplier risk workspace",
        "action": "ora.App.setContext(\"{\\\"supplierId\\\":\\\"SUP-1042\\\"}\")"
      }
    ]
  }
}
</oraInfoDisplay>

When the user searches for a context, handle QueryContextSuggestions. Read the search text from $context.$system.$inputMessage and return the same message-list shape. Return an empty items array for no results.

An LLM handler can also be instructed to produce items with a title, app context string, optional description, and optional badge text; the runtime sets up the corresponding fields and actions. Keep the initial suggestions and search handlers focused on context selection.

Route the workflow by request type

Use an If Condition or Switch node to distinguish initial suggestions from search requests. For example, an If Condition can identify the initial request with:

{{$context.$app.$OraMessageHint === "InitContextSuggestions"}}

Send InitContextSuggestions to a handler that returns an allowed default or an initial list of contexts. Handle QueryContextSuggestions with a separate search path: pass $context.$system.$inputMessage into the handler, filter the available contexts, and return the matching items in a message list. Return an empty list when nothing matches.

Validate the switcher

  • Open the app without a context and confirm that initial choices appear, or that an allowed default opens the scoped app.
  • Select a choice and confirm that downstream agents receive the expected context string.
  • Return to the switcher and confirm that OraRequestDefaultAppContext = false shows choices instead of reopening a default.
  • Search for a matching context and for a value with no matches.

Context is distinct from panel identity

Value Purpose
$OraAppContext Business scope of the app
$OraAppDisplayDiscriminator Which top-level startup panel requested InitDisplay
$OraPanelName Which additional focus panel requested AdditionalContent
$OraQueryFilter Category and search string for an Ask Oracle value lookup

Test default selection, search, empty results, return to the switcher, and context changes. Dynamic starter queries are requested again when app context changes.