Populate error message in OnLoad client script with Script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 09:34 AM
Hello,
We got a requirement of one field ABC is refence to another table and if it is taking inactive records then showing alert or error message if form loads. Please let us know how can we achieve in onLoad client script.
Thank you!!
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2022 10:00 AM
Hi,
Try this in Client script. Note- Modify it as per your field names.
var abc_field_value = g_form.getReference("abc", checkActive);
function checkActive(abc_field_value) {
// alert(abc_field_value.active);
if (abc_field_value.active == "false") {
alert("The " + abc_field_value.name + " is in-active.");
g_form.addErrorMessage("The " + abc_field_value.name + " is in-active."");
}
}
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 10:36 AM
Hi Sagar,
I have tried your client script but it is not working, not showing the alert or error message after form load. Please check from your end.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 10:42 AM
Hi,
I have added it for Change request [rfc] field on incident form. It is working as expected for me & showing alert/ Error message when the Change request state is closed.
Share you client script configurations and your form screenshots. It will help to troubleshoot the issue.
Thanks!
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2022 10:49 AM
Hey,
I think name of the function is incorrect:
function checkChangeState(abc_field_value) {
It should be:
function checkActive(abc_field_value) {
Aman Kumar