how to check if the variable is present on the form or not using client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 04:05 AM
g_form.hasField() and g_form.isVisible is not working, please advise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 04:14 AM
If you're in the Core UI, you would need to use g_form.isFieldVisible('field_name_here'), for service portal g_form.isVisible will work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2025 02:38 PM
This was the solution for me, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 04:35 AM
Hi @GD11 ,
Use the g_form.getControl(fieldName) method. This method returns the HTML element for the specified field. If the field does not exist on the form, it returns null.
function onLoad() {
var name = g_form.getControl('u_application_name');
if(name !== null)
name.placeholder = "Common name for the application";
}
Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2024 04:55 AM
This is another function that works
alert(g_form.hasField('<variable name>'));