- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:23 AM
We need to list all the mandatory fields in the record using a client script (code)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 07:16 AM
Hi @AK001025799 ,
1.Create a onLoad client script.
Table - Incident
UI type - All
Type - onLoad
Active - checked
Global - Checked else specify viewName
2.Add the following script with a delay
function onLoad() {
// Delay execution by 500ms to allow Dictionary Overrides to fully load in the browser
setTimeout(function() {
var fields = g_form.getEditableFields();
var mandatoryFieldsList = [];
for (var i = 0; i < fields.length; i++) {
var fieldName = fields[i];
if (g_form.isMandatory(fieldName)) {
var fieldLabel = g_form.getLabelOf(fieldName);
mandatoryFieldsList.push(fieldLabel);
}
}
// If mandatory fields are found, display them
if (mandatoryFieldsList.length > 0) {
g_form.addInfoMessage("The following fields are mandatory:\n\n" + mandatoryFieldsList.join(","));
}
}, 500); // 500 milliseconds delay
}
3.Save the record.
4.you will get a Info message on form load.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:37 AM
pls remove the console.log line n try
function onLoad() {
var mandatoryFields = [];
var elements = g_form.elements;
for (var i = 0; i < elements.length; i++) {
var fieldName = elements[i].fieldName || elements[i].name;
if (fieldName && g_form.isMandatory(fieldName)) {
mandatoryFields.push(fieldName);
}
}
alert("Mandatory Fields:\n" + mandatoryFields.join("\n"));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:36 AM
@AK001025799
Can you please try using this:
function onLoad() {
var mandatoryFields = [];
var allFields = g_form.getFieldNames();
for (var i = 0; i < allFields.length; i++) {
var fieldName = allFields[i];
if (g_form.isMandatory(fieldName)) {
mandatoryFields.push(g_form.getLabelOf(fieldName));
}
}
g_form.addInfoMessage("Mandatory Fields: " + mandatoryFields.join(", "));
}
May be because if getEditableFields() is not supported in your instance it will not work.
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:40 AM
can you please send me the screenshot of your pdi ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:45 AM
HI @AK001025799 ,
Can you please share more info about your use case.
Where you want to display all mandatory fields?
When you want to display onLoad or onSubmit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2026 06:48 AM