Skip to content

I want to change the default view for each logged-in user

Answer

Please use "Server Script".


Overview

Change the view of the displayed list screen for each logged-in user. If the user ID is 1, view ID 1 will be set, if the user ID is 2, view ID 2 will be set, and for other users, view ID 3 will be set as the "Default View".

Operation Procedure

  1. Create a "Recorded Table".
  2. Create a new view in "Manage Table" → "View".
  3. Make a note of the target user ID and view ID in advance. Check the user ID from "Manage" - "User Management" in the navigation menu, and the view ID from "Manage" → "Manage Table" → "View" → "Advanced Settings" in the navigation menu.
    User management screen where the user ID can be checked
    Advanced settings of a view where the view ID can be checked

  4. Create a new "Server Script" as follows. For "Condition", select "When site settings are loaded."

Script

JavaScript
if (context.UserId === 1) {   //If user ID is 1
    siteSettings.DefaultViewId = 1;   //Set the default view to the view with ID 1
} else if (context.UserId === 2) {   //If user ID is 2
    siteSettings.DefaultViewId = 2;   //Set the default view to the view with ID 2
} else {   //If user ID is other than the above
    siteSettings.DefaultViewId = 3;   //Set the default view to the view with ID 3
}