sn_create_user
Create a ServiceNow user with standard fields, optional roles, and group membership. Handles common mistakes like username generation and default active status.
Instructions
Create a ServiceNow user (sys_user) with all standard fields, optional roles, and optional group membership.
Handles the fields that developers most commonly miss or set incorrectly:
Generates a valid user_name if not provided
Sets active=true by default
Optionally assigns roles directly on the user record
Optionally adds the user to one or more groups in one call
Returns the new user's sys_id plus links to role and group records created.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| first_name | Yes | First name | |
| last_name | Yes | Last name | |
| Yes | Email address (used for notifications) | ||
| user_name | No | Login username — auto-generated from first.last if not provided | |
| title | No | Job title | |
| department | No | Department name or sys_id | |
| manager | No | Manager username, email, or sys_id | |
| phone | No | Business phone number | |
| mobile_phone | No | Mobile phone number | |
| location | No | Location name or sys_id | |
| time_zone | No | e.g. "America/New_York" | |
| date_format | No | e.g. "MM/dd/yyyy" | |
| language | No | Language code (default: en) | en |
| password | No | Initial password. If omitted, user must reset on first login. | |
| active | No | ||
| vip | No | Mark as VIP (affects SLA) | |
| roles | No | Role names to assign (e.g. ["itil","catalog"]) | |
| groups | No | Group names or sys_ids to add the user to | |
| extra_fields | No | Any additional sys_user fields |