Uncaught ReferenceError: g_list is not defined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2017 09:22 AM
I am writing an onSubmit catalog client script and I want to check if a value in a reference field is included in a list collector. The purpose being that the same user cannot be listed in both places. Here is what I'm trying to do:
var collectorName = 'add_employees_list';
var myListCollector = g_list.get(collectorName);
var selectedOptions = g_form.getValue(collectorName).split(',');
var approver = g_form.getValue('new_hire_approval_email');
if (selectedOptions.includes(approver) == 1) {
alert("The approver cannot be included in the Additional Employees list. Please select a different approver.");
return false;
}
When I run this code, the console returns "Uncaught ReferenceError: g_list is not defined". I'm not sure why g_list is coming back as undefined. Any ideas?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2017 09:24 AM
Try to use g_form in the place of g_list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2017 09:32 AM
Actually I realized that the myListCollector variable wasn't even necessary for what I was trying to accomplish. By removing the variable from the script, it worked. Thank you for your response!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2017 09:34 AM
Here is something I got from wiki:
g_list is the variable used to access a specified list object. The g_list variable is not available to the related lists form link UI action. It is available to the lists form link UI action.
As your issue is resolved try to remove your question from unanswered list