- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 06:28 AM
Hi all,
I have a table called u_job_title with two fields.
On my catalog item, I have a Job Title field that looks up to this table.
I have a Catalog Client Script that I would like to limit the department list based on if the selected Job Title contains "Paralegal" or "Paraprofessional" or "Law Clerk".
I have a function that returns "yes" or "no" depending on whether the job title contains those texts:
function ifParalegalOrLawClerk() {
alert(newValue);
var gr = new GlideRecord('u_job_title');
gr.get(newValue);
var jobtitle = gr.u_job_title_english;
var paralegal = jobtitle.indexOf("Paralegal");
var paraprof = jobtitle.indexOf("Paraprofessional");
var clerk = jobtitle.indexOf("Law Clerk");
var check;
if (paralegal >= 0) {
return 'yes';
}
if (paraprof >= 0) {
return 'yes';
}
if (clerk >= 0) {
return 'yes';
}
return 'no';
}
This function can't seem to get the u_job_title_english value. It returns "undefined".
newValue is a reference field of the newly selected Job Title.
I am not sure what I am doing wrong here. Please help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 06:32 AM
Hi
You cannot use GlideRecord in client script.
Use GlideAjax with client callable script include to get server side data.
Mark it as correct or helpful if it does.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2022 06:32 AM
Hi
You cannot use GlideRecord in client script.
Use GlideAjax with client callable script include to get server side data.
Mark it as correct or helpful if it does.
Regards,
Sumanth