This guide explains three administrative utilities that help ensure Staff and WebUser records have consistent identifying codes. These actions run from the Admin Functions page and update data in bulk. ## Overview - Add WebUser Codes (from Username): Sets missing WebUser codes using each user’s username. - Add Staff Codes: Copies each WebUser’s code to their linked Staff when Staff code is empty. - Copy Staff Code → Staff StaffCode: Copies each Staff’s existing code into the separate StaffCode field when StaffCode is empty. ## When to Use - After user imports or migrations where codes were not populated. - When Staff records exist without codes but their linked WebUsers have codes. - When legacy data uses `code` but UI or reports expect `staffCode`. ## How to Navigate 1) Open the application. 2) Administration → Manage Metadata → Manage Metadata Page. 3) In the left panel, open “System Administrator Functions”. 4) Click “Admin Functions” to open the Admin Functions page. 5) Select the “Staff” tab. ## Actions and Buttons All actions appear in the Staff tab as table rows with a Name, Description, Action button, and Output column. 1) Add WebUser Codes (from Username) - Button: “Add WebUser Codes” - What it does: For active WebUsers with an empty Code but a non-empty Username, assigns the Username as the Code. - Typical use: Run first to ensure all WebUsers have a code before syncing to Staff. 2) Add Staff Codes - Button: “Add Staff Codes” - What it does: For WebUsers linked to a Staff member where Staff Code is empty, copies the WebUser’s Code to Staff Code. - Typical use: Run after “Add WebUser Codes” to propagate codes from users to staff. 3) Copy Staff Code → Staff StaffCode - Button: “Copy to StaffCode” - What it does: For Staff with an empty StaffCode but a non-empty Code, copies Code into StaffCode. - Typical use: Run last to ensure the `staffCode` field (commonly shown in UIs/reports) is populated. ## Understanding Messages and Output - Success banner: Displays a message like “Updated web user codes: N” or “Updated staff codes: N”. - Output column: Shows the last action’s summary (e.g., total updated records). - No change: If N = 0, there were no matching records to update. ## Recommended Order 1) Add WebUser Codes (from Username) 2) Add Staff Codes 3) Copy Staff Code → Staff StaffCode Running in this order ensures data flows from Username → WebUser Code → Staff Code → Staff StaffCode. ## Best Practices - Run during off-peak hours if you expect many updates. - Review counts in the Output column after each action. - Re-run an action if new users/staff were added since the last run. - Communicate the change to staff who depend on codes for searches and reports. ## Troubleshooting - “Nothing updated (0)”: Data already compliant or no records match the criteria. - Staff missing link to WebUser: “Add Staff Codes” updates only when WebUser is linked to Staff. - Confusing results: Run actions in the recommended order and re-check Output counts. - Permissions: If you cannot see the Admin Functions page, contact a system administrator. ## Configuration (User Impact) - These actions do not change user roles or privileges. - Codes become visible in various screens and reports where staffCode is displayed. ## FAQ **Q: Is this reversible?** A: Changes are saved immediately. To revert, edit codes manually via user/staff management pages. **Q: Will existing codes be overwritten?** A: No. Each action only updates empty fields (WebUser Code, Staff Code, or Staff StaffCode). **Q: Can I run these more than once?** A: Yes. Re-running simply updates any newly added empty fields. **Q: Who should run these actions?** A: System administrators or authorized staff responsible for data consistency. [Back](https://github.com/hmislk/hmis/wiki/System-Administration-Functions)