Use Case: Screen Redirection Based on User Role

In an application, you may want to redirect users to different screens based on their roles (e.g., Admin, User, Guest). Kuika's If Then Else action allows you to easily perform such role-based redirection. With this action, the role of the user logging into the application is checked, and they are redirected to the appropriate screen. This provides a personalised experience for the user and ensures authorisation management.

Add the If Then Else Action

  1. Log in to the Kuika platform.
  2. Open the project you want to work on from the Apps screen.
  1. While in the UI Design module, open the Properties panel on the right side.
  2. Select the component you want to add the action to (e.g., the ‘Log In’ button).
  3. Follow these steps from the + ADD ACTION drop-down menu: 
    • Onclick → Condition → If Then Else.

Configure If Then Else Parameters

In the window that opens, configure the following fields:

The ‘Will Execute If’ field is the section that checks whether the condition you defined is true. Here, you write a condition that specifies in which case the system will execute the ‘If Actions’ section. If this condition is met, the ‘If Actions’ will be executed.

If it is not met, i.e. if the condition is false, the ‘Else Actions’ are executed.

Example usage

  • Condition (Will Execute If): data.user.role == “Admin”
  • If Actions: Navigate to AdminPanel
  • Else Actions: Navigate to UserPanel

In this example:

  • If the user's role is ‘Admin’ → Redirect to the AdminPanel screen.
  • If not → the user is redirected to the UserPanel screen.

What Types of Conditions Can I Write?

In the ‘Will Execute If’ field, you can write

  • Text comparisons (==, !=, contains, starts with)
  • Space checks (is empty, is not empty)
  • Date/time comparisons
  • List checks
  • GUID validations
  • You can write logical expressions such as these.

If Actions: You can define the actions to be performed if the condition is true here.

Example: If the condition ‘data.user.role’ = ‘Admin’ is met, redirect to the AdminPanel screen.

Else Actions: You can specify the actions to be performed if the condition is false.

Example: If the user is not an admin, redirect to the UserPanel screen.