FAQ: I want to change the default view for each logged-in user
## Answer
Please use "[Server Script](/en/manual/table-management-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](/en/manual/table-management-default-view)".
## Operation Procedure
1. Create a "Record table".
1. Create a new view in "[Table Management](/en/manual/table-management)" → "[View](/ja/manual/table-management-view)".
1. Make a note of the target user ID and view ID in advance. Check the user ID from "Management" - "User Management" in the navigation menu, and the view ID from "Management" → "[Table Management](/en/manual/table-management)" → "[View](/ja/manual/table-management-view)" → "Advanced Settings" in the navigation menu.
![image](https://pleasanter.org/binaries/073629a6300147d3b7dc7f1ab2efea1c)
![image](https://pleasanter.org/binaries/e3c3607b150a465895a7944fae47598d)
1. Create a new "[Server Script](/en/manual/table-management-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
}
```
## Related Information
<div id="ManualList"><ul><li><a href="/en/manual/table-management">Manage Table</a><span>10.02.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/table-management-default-view">Manage Table: Screen Index: Default View</a><span>10.11.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/table-management-view">Manage Table: View</a><span>10.03.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article>
<ul><li><a href="/en/manual/api-view">開発者向け機能:JSONデータレイアウト:View</a><span>11.06.2023 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />