Integrate custom web page with servicenow sys_user table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 10:52 PM
Hello everyone,
I have created a custom webpage using Visual Studio Code with basic fields such as First Name, Last Name, Email, and User ID, along with a submit button. Now, I need to integrate it with ServiceNow so that when a user submits the form in webpage, a new record is created in the sys_user table of my ServiceNow instance.
Can anyone help me achieve this integration? Please refer the below attachments and scripts to know more about the web page. Thanks in advanced!!
HTML Script.
------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Auto Populate User ID</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
label {
display: block;
margin-top: 10px;
}
input {
width: 300px;
padding: 5px;
margin-top: 5px;
}
button {
margin-top: 15px;
padding: 10px 15px;
cursor: pointer;
}
</style>
<script>
function generateUserId() {
let firstName = document.getElementById("firstName").value.trim().toLowerCase();
let lastName = document.getElementById("lastName").value.trim().toLowerCase();
let userIdField = document.getElementById("userId");
if (firstName && lastName) {
userIdField.value = firstName + "." + lastName;
} else {
userIdField.value = "";
}
}
function submitForm(event) {
event.preventDefault();
let firstName = document.getElementById("firstName").value;
let lastName = document.getElementById("lastName").value;
let email = document.getElementById("email").value;
let userId = document.getElementById("userId").value;
let userData = `<tr><td>${firstName}</td><td>${lastName}</td><td>${email}</td><td>${userId}</td></tr>`;
localStorage.setItem("userTableData", localStorage.getItem("userTableData") + userData);
window.location.href = "userTable.html";
}
</script>
</head>
<body>
<h2>User Registration</h2>
<form onsubmit="submitForm(event)">
<label for="firstName">First Name:</label>
<input type="text" id="firstName" name="firstName" oninput="generateUserId()" required>
<label for="lastName">Last Name:</label>
<input type="text" id="lastName" name="lastName" oninput="generateUserId()" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="userId">User ID:</label>
<input type="text" id="userId" name="userId" readonly>
<button type="submit">Submit</button>
</form>
</body>
</html>