Select Organization

B2B identity

Retrieves the list of organizations the user belongs to and prompts the user to select an organization to proceed with.

About client-facing steps

A journey is a sequence of steps that are executed when it's invoked by a client application (known as the "client"). Some steps require involvement from the client, such as to collect user input. Other steps, like validating a token, are executed in the backend by the Mosaic journey engine alone.

When invoked, the journey begins executing the steps while the client waits for further instructions. When a journey reaches a client-facing step, the journey asks the client for the required input and then waits for the client to respond. The client presents their own UI if user interaction is required, and returns input to the journey. The journey then proceeds in a similar manner until it’s completed.

Description

This step allows selecting an organization to proceed with in the B2B journey. By selecting an organization and setting org context, you can tailor the journey experience to organization requirements, for example, enforce specific login methods.

The user context for this step may be provided implicitly by the journey if the user is already authenticated; otherwise, a user identifier must be specified in the step configuration. Once triggered, this step retrieves the user’s organization list. Depending on the organizations the user is associated with, the step can be client-facing or it can be handled implicitly by Mosaic.

  • User belongs to multiple organizations : the client has to present a UI form to choose an organization before setting the context for the subsequent B2B journey steps.
  • User belongs to a single organization : no user interaction is needed; the org context is set automatically for the subsequent B2B journey steps.

If the step is successfully completed, the journey returns the organization ID, stores it in the configured output variable, and sets the org context. In subsequent journey steps, the organization data will be available via @organizations.current() expressions, for example, @organizations.current().organization_id or @organizations.current().name. If the step fails, the journey proceeds to a failed branch (if one is specified); otherwise, the journey is aborted and an error is sent to the client.

Configuration

Field Description
User auth state Indicates if the user has authenticated in this journey. If the user is authenticated (default), the user context is provided implicitly by the journey. If not, a user identifier must be configured.
External user ID User identifier, specified as an expression. Only configured if the journey doesn't authenticate the user before invoking this step.
Output variable Name of the variable that stores the organization ID.
Error output variable Name of the variable that stores any errors returned by the step
Failure behavior Determines the behavior in case of failure, which either aborts the journey or proceeds to a failure branch of the control flow (default).

Examples

The step behaves differently depending on how many organizations the user belongs to—the step can be client-facing or it can be handled implicitly without user interaction.

Single organization

Suppose a user belongs to a single organization. When executed, this step retrieves user's organizations. Since there is just one organization available, the step automatically selects it and sets the org context without any user interaction.

Multiple organizations

Suppose a user is a member of two organizations. When executed, this step retrieves user's organizations. Since there is more than one organization associated with the user, it sends a callback to the client with the IDO service response object. It will have the journeyStepId set to SelectOrganization and the data will include the list of organizations the user is a member of. For example:

Copy
Copied
{
 "data": {
   "organizations": [
     {
       "id": "aq5Doa_GMiDhL2GC-ABCD",
       "name": "Organization 1"
     },
     {
       "id": "mkiPd9tu0K2h9oCM9ZYXW",
       "name": "Organization 2"
     }
   ]
  }
}

The client will present a form for selecting an organization and return response to the journey in order to set the org context. For example:

Copy
Copied
tsPlatform.ido.submitClientResponse(
   ClientResponseOptionType.ClientInput,
   {
     "organization_id": "aq5Doa_GMiDhL2GC-ABCD"
   }
)