Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Field Review of User Record when on form using action button

Displays informational messages suggesting improvements to field formatting on the User Table (**sys_user**) form when the **Fields Check** button is clicked.

- Helps maintain consistency in user data by checking capitalization of names and titles, validating email format, ensuring phone numbers contain only digits, and preventing duplicate phone entries.
- Also suggests users not to leave the **user_name** field empty.
- Shows Info messages below each field highlighting fields that may need attention.
- Simple Prerequisite is that: when form loads give Info message to check **Field Check** button to bring user's attention
- Uses a Client-side UI Action (**Fields Check**) that to review entered data and display friendly suggestions
- Name: Fields Check
- Table: User (sys_user)
- Client: true
- Form button: true
- Onclick: onClickCheckDetails()

---

### Grab user's attention on Field Check Button using Info message at top

![Field Review on User Table_1](Field_Review_userTable_1.png)

---

### After clicking Field Check Button where suggestions are displayed below fields

![Field Review on User Table_2](Field_Review_userTable_2.png)

---

### When user fixes the suggested issues and click the **Fields Check** button again, a message confirms that all fields are correctly formatted

![Field Review on User Table_3](Field_Review_userTable_3.png)

---
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
function onClickCheckDetails() {
// Friendly helper for field normalization guidance
g_form.hideAllFieldMsgs();
g_form.clearMessages();

// --- Get Field values ---
var firstName = g_form.getValue('first_name');
var lastName = g_form.getValue('last_name');
var title = g_form.getValue('title');
var userId = g_form.getValue('user_name');
var email = g_form.getValue('email');
var businessPhone = g_form.getValue('phone');
var mobilePhone = g_form.getValue('mobile_phone');

// --- Regex patterns ---
var capitalRegex = /^[A-Z][a-zA-Z\s]*$/; // Names & titles start with a capital
var emailRegex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;
var phoneRegex = /^\d+$/;

var suggestions = [];

if (firstName && !capitalRegex.test(firstName)) {
g_form.showFieldMsg('first_name', 'Suggestion: Start the name with a capital letter.', 'info');
suggestions.push('First Name');
}

if (lastName && !capitalRegex.test(lastName)) {
g_form.showFieldMsg('last_name', 'Suggestion: Start the name with a capital letter.', 'info');
suggestions.push('Last Name');
}

if (title && !capitalRegex.test(title)) {
g_form.showFieldMsg('title', 'Suggestion: Titles usually start with a capital letter.', 'info');
suggestions.push('Title');
}

if (!userId) {
g_form.showFieldMsg('user_name', 'Suggestion: Do not keep the User ID empty.', 'info');
suggestions.push('User ID');
}

if (email && !emailRegex.test(email)) {
g_form.showFieldMsg('email', 'Suggestion: Please use a valid email format like name@example.com.', 'info');
suggestions.push('Email');
}

if (businessPhone && !phoneRegex.test(businessPhone)) {
g_form.showFieldMsg('phone', 'Suggestion: Use digits only avoid letters.', 'info');
suggestions.push('Business Phone');
}

if (mobilePhone && !phoneRegex.test(mobilePhone)) {
g_form.showFieldMsg('mobile_phone', 'Suggestion: Use digits only avoid letters.', 'info');
suggestions.push('Mobile Phone');
}

/
if (businessPhone && mobilePhone && businessPhone === mobilePhone) {
g_form.showFieldMsg('phone', 'Work and mobile numbers appear identical, use different Numbers!', 'info');
suggestions.push('Phone Numbers');
}

if (suggestions.length > 0) {
g_form.addInfoMessage('Quick review complete! Please check: ' + suggestions.join(', ') + '.');
} else {
g_form.addInfoMessage('looks good! Nicely formatted data.');
}
}
Loading